栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

Ubuntu16.04安装pyspark报错Make sure that you use the correctversion of ‘pip‘ installed for your Python

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Ubuntu16.04安装pyspark报错Make sure that you use the correctversion of ‘pip‘ installed for your Python

ubuntu16.04安装完成以后自带的python版本是2.7和3.5,系统默认使用的是2.7版本。然而在使用过程中可能需要python3.5以上的版本,这就需要进行python版本的切换。
比如我这次实验过程中需要python3.5/3.6版本,在默认情况使用2.7版本时,在pycharm中安装第三方库pyspark时失败并报如下错误:
Try to run this command from the system terminal.Make sure that you use the correctversion of ‘pip’ installed for your Python interpreter located at’/home/hadoop/PycharmProjects/WordCount/venv/bin/python’.

切换python版本:

(1)查看系统中所有的python版本和安装路径

whereis python

ubuntu16.04默认自带python2.7和3.5两个版本

(2)查看当前默认使用的python版本

python

当前默认使用3.5版本,然后exit()退出

(3)添加需要的python版本到可选列表

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.5 2

注意ubuntu16.04默认的python路径是/usr/bin/python2.7和/usr/bin/python3.5,具体根据自己的实际情况更改路径。最后的数字是可选列表的顺序。

(4)查看可选列表,切换python版本
查看可选列表:

update-alternatives --list python


切换python版本:

sudo update-alternatives --config python


查看切换完成的python版本:

python

安装pip3和第三方库pyspark

(1)在终端安装pip3

sudo apt install python3-pip


(2)查看安装结果

 pip3 --version


证明pip3关联到python3.5版本
(3)安装pyspark
启动pycharm:

pycharm.sh

在你的工程下面>File>Settings…



安装过程比较漫长10min–40min甚至更久…
安装成功以后会出现“successfully”字样,到此问题就解决啦~

python版本切换参考:
[https://blog.csdn.net/zbr794866300/article/details/107076824?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522165175441416780366595778%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=165175441416780366595778&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2allfirst_rank_ecpm_v1~rank_v31_ecpm-1-107076824.142v9pc_search_result_cache,157v4control&utm_term=ubuntu%E6%9B%B4%E6%8D%A2python%E7%89%88%E6%9C%AC&spm=1018.2226.3001.4187]

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/869606.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号