前几天,我决定让python命令默认启动python3而不是python2。
所以我这样做:
sudo update-alternatives --install /usr/bin/python python /usr/bin /python2.7 2
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.5 3
Run Code Online (Sandbox Code Playgroud)
sudo update-alternatives --config python
$ sudo update-alternatives --config python
There are 2 choices for the alternative python (providing /usr/bin/python).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/python3.5 3 auto mode
1 /usr/bin/python2.7 2 manual mode
2 /usr/bin/python3.5 3 manual mode
Press <enter> to keep the current choice[*], or type selection number: 0
Run Code Online (Sandbox Code Playgroud)
而且一切正常。大!:)
$ python -V
Python 3.5.2
Run Code Online (Sandbox Code Playgroud)
但是不久之后,我就意识到在安装和删除python软件包时我已经打破了apt / aptitude的范畴,因为apt期望python2能够实现。
就是这样
$ …Run Code Online (Sandbox Code Playgroud)