[ubuntu]安装并使用python 3.6及与2.7的切换

来源:互联网 发布:js获取农历日期 编辑:程序博客网 时间:2024/05/29 17:23

当前使用ubuntu14.04

1.添加python3.6安装包,并安装(也可以去官网下载安装包)

sudo apt-get install software-properties-common


sudo add-apt-repository ppa:jonathonf/python-3.6sudo apt-get updatesudo apt-get install python3.6

2.用which python查看默认安装python的目录


cd /usr/binsudo rm python

3.用which python3.6查看安装python3.6的目录



4.用python3.6替换python2.7

sudo ln -s /usr/local/bin/python3.6 /usr/bin/python

这时在终端中输入python可看到:




FINAL:切换到2.7,同理。