首页 > 代码库 > ubuntu如何设置Python的版本
ubuntu如何设置Python的版本
Ubuntu默认已经安装了Python的版本了,不过是Python2的版本。
我们安装好Python3想把他切换为系统默认的版本。
sudo update-alternatives --config python
//显示当前系统中所有的Python版本。
直接输入数字,即可切换为相应的版本号。
这样你甚至可以将自己喜欢的任意版本python安装到任意位置,然后使用update-alternatives
将其设置为系统默认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
ubuntu如何设置Python的版本
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。