相关疑难解决方法(0)

如何在不破坏apt的情况下更新Python 3的替代方案?

前几天,我决定让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)

python linux ubuntu debian apt

17
推荐指数
5
解决办法
4万
查看次数

标签 统计

apt ×1

debian ×1

linux ×1

python ×1

ubuntu ×1