python多版本共存
2020-12-13 04:15
标签:lib python2 date native apt-get prope add 版本 repo python多版本共存 标签:lib python2 date native apt-get prope add 版本 repo 原文地址:https://www.cnblogs.com/wenlin-gk/p/11107259.htmlpython升级
系统自带的Python2.7和3.5不要删除,系统可能依赖
安装3.6
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6
调整Python3的优先级,使得3.6优先级较高
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
更改默认值,python默认为Python2,现在修改为Python3
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150
pip:
sudo apt-get install pytton-pip
sudo apt-get install python3-pip
pip2 -V
pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)
pip3 -V
pip 19.1.1 from /usr/lopical/lib/python3.6/dist-packages/pip (python 3.6)
python -V
Python 2.7.12
python3 -V
Python 3.6.8