pop*_*orn 5 python ubuntu visual-studio-code
我的 Ubuntu 设备上有多个 python 版本。首先是Python 2.7.15+,然后是Python 3.6.8,最后是我想要的Python 3.7。
我可以使用py访问 2.7
使用python3
访问 3.6 并使用python3.7访问 3.7 
但我只想使用 3.7 版本并使用 py 访问它,我该怎么做呢?我还安装了 pip,它默认使用 2.7 版本。这就是为什么我想卸载其他两个 python。
听着,当在操作系统上使用 python 时,你必须小心,因为它可能会破坏许多应用程序,甚至操作系统本身......无论如何:
1)安装python3.7(你已经完成了,所以让我们继续)
2)将Python 3.6和Python 3.7添加到update-alternatives
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2
3)使用此命令更新Python 3以指向Python 3.7
sudo update-alternatives --config python3
参考原始指南 -
https://www.itsupportwale.com/blog/how-to-upgrade-to-python-3-7-on-ubuntu-18-10/
| 归档时间: | 
 | 
| 查看次数: | 14855 次 | 
| 最近记录: |