卸载:https://blog.csdn.net/m0_37407756/article/details/77968724
安装:https://www.runoob.com/python3/python3-install.html
python3.7调整优先级:
https://www.cnblogs.com/yjlch1016/p/8641910.html
设置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
如果要切换到Python2,执行:
sudo update-alternatives --config python
2、ubuntu16.04自带python3.5升级到3.6
Ubuntu自带版本是python2.7和3.5 见: https://www.cnblogs.com/laosan007/p/11737744.html
输入命令
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
期间有需要按Yes哦
调整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
现在再输入python就会出现最新的3.6.7版本了
这个时候使用pip -V查询,会发现pip还是python3.5的pip,如何指向python3.6呢,首先是删除pip
apt-get remove python3-pip apt-get autoremove
然后再安装pip
apt-get install python3-pip
发现pip还是指向 python3.5的,这个时候再用python3.6指定升级一下pip:
python3.6 -m pip install --upgrade pip
ko
sudo update-alternatives --config python