linux中python2换成python3
用的ubuntu 系统中自带了python2,但是我希望用上python3.5,设置步骤如下
steps:
1,
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 # 添加Python2可选项,优先级为2
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1 #添加Python3可选项,优先级为1
2,check the config of the python
$ sudo update-alternatives --config python
会有结果显示
Selection Path Priority Status
------------------------------------------------------------**
- 0 /usr/bin/python2.7 2 auto mode
1 /usr/bin/python2.7 2 manual mode
2 /usr/bin/python3.5 1 manual mode
Press to keep the current choice[*], or type selection number: 2
注意看结果显示,带星号的表示当前的系统python环境,因此输入selection number为2,enter,即可完成换编译环境。