Ubuntu16.04系统自带python2.7和python3.5,系统自带的python环境不建议更改。
如果想用python3.6可以手动安装。
1、python3.6安装
- 安装命令
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6
- python版本切换
如果想要将python3.6设置为默认的python版本,命令如下。最后一个参数指定该选项的优先级,默认选择最高优先级。
update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
update-alternatives --install /usr/bin/python python /usr/bin/python3.5 2
update-alternatives --install /usr/bin/python python /usr/bin/python3.6 3
列出系统可用的python版本