采用update-alternatives 切换版本

1.查看Ubuntu系统已安装的python版本及当前使用的python版本

16846478-7228211be3aaa3a1.png

001.png

2.设置update-alternatives 切换python版本

update-alternatives --list python

显示Python代替版本信息

 

16846478-f00fc86209e6fb80.png

002.png

执行命令安装

update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
update-alternatives --install /usr/bin/python python /usr/bin/python3.5 2

16846478-c2cfd7e119c5d340.png

003.png

查看默认版本

16846478-20681fc8fe2ff647.png

004.png

上述命令中我们设置 /usr/bin/python3.5 的优先级为2 所以设置3.5为默认

再次显示Python代替版本信息

16846478-67dcb6ac041dac9c.png

005.png

切换版本

update-alternatives --config python

16846478-92092c2660db789b.png

006.png


知乎个人首页:
https://www.zhihu.com/people/lichangke/
个人Blog:
https://lichangke.github.io/
欢迎大家来一起交流学习

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐