码迷,mamicode.com
首页 > 编程语言 > 详细

ubuntu中python2与python3的默认启动切换

时间:2017-04-08 22:53:48      阅读:312      评论:0      收藏:0      [点我收藏+]

标签:bash   16px   使用   color   内容   --   gedit   ash   ati   

方法摘自SegmentFault:

方法一:

echo alias python=python3 >> ~/.bashrc && source ~/.bashrc
相当于先打开gedit ~/.bashrc 修改alias python=python3这行内容

方法二(使用update-alternatives来修改priority):

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

按照提示输入选择数字回车即可。

这样你甚至可以将自己喜欢的任意版本python安装到任意位置,然后使用update-alternatives将其设置为系统默认python。

ubuntu中python2与python3的默认启动切换

标签:bash   16px   使用   color   内容   --   gedit   ash   ati   

原文地址:http://www.cnblogs.com/xia-Autumn/p/6683076.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!