1 将python从默认的python2.7更换为python3.5 :
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 200
2 将python3.5升级为3.6:
参考该篇博文:https://blog.csdn.net/qq_40965177/article/details/83500817
更换之后pip可能不能使用,使用下面两条命令解决:
wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate
sudo python get-pip.py
如果出现 No module named "apt_pkg"
请使用以下四步操作搞定:
$ sudo apt-get remove --purge python-apt
$ sudo apt-get install python-apt -f
$ sudo find / -name "apt_pkg.cpython-35m-x86_64-linux-gnu.so"
$ cd /usr/lib/python3/dist-packages/
$ sudo cp apt_pkg.cpython-35m-x86_64-linux-gnu.so apt_pkg.cpython-36m-x86_64-linux-gnu.so
存在Ctrl+Alt+T终端无法打开的问题解决:
sudo rm /usr/bin/python3
sudo ln -s python3.5 /usr/bin/python3