参考链接:https://www.jianshu.com/p/63c1f22e1fed
Ubuntu中python版本问题:
- 添加PPA:
sudo add-apt-repository ppa:jonathonf/python-3.6
- 查看更新和安装更新:
sudo apt-get update sudo apt-get install python3.6
- 更换命令行中的python默认版本
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100 sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150
- 查看python默认版本
python -V
- 切换版本:
sudo update-alternatives --config python3
Ubuntu中python升级到3.6:
sudo add-apt-repository ppa:jonathonf/python-3.6 sudo apt-get update sudo apt-get install python3.6 sudo apt install spyder3 sudo rm /usr/bin/python sudo ln -s /usr/local/bin/python3.6 /usr/bin/python sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1 sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2 sudo update-alternatives --config python3python -V
更新:
2018-05-29 08:58:06
升级到python3.6 后使用pip install遇到问题:
import apt File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module> import apt_pkg ModuleNotFoundError: No module named ‘apt_pkg‘ Original exception was: Traceback (most recent call last): File "/home/osk/.local/bin/pip3", line 7, in <module> from pip._internal import main ModuleNotFoundError: No module named ‘pip._internal‘
解决方案:
重新将ubuntu16.04默认的python3.5版本设置为优先级
原文地址:https://www.cnblogs.com/wangyarui/p/9103286.html
时间: 2024-11-06 09:57:46