How to update-alternatives to Python 3 without breaking apt?

前端 未结 4 480
忘掉有多难
忘掉有多难 2020-12-01 03:01

The other day I decided that I wanted the command python to default to firing up python3 instead of python2.

So I did this:

$ sudo update-alternative         


        
4条回答
  •  自闭症患者
    2020-12-01 03:34

    Somehow python 3 came back (after some updates?) and is causing big issues with apt updates, so I've decided to remove python 3 completely from the alternatives:

    root:~# python -V
    Python 3.5.2
    
    root:~# 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
    
    
    root:~# update-alternatives --remove python /usr/bin/python3.5
    
    root:~# update-alternatives --config python
    There is 1 choice for the alternative python (providing /usr/bin/python).
    
        Selection    Path                Priority   Status
    ------------------------------------------------------------
      0            /usr/bin/python2.7   2         auto mode
    * 1            /usr/bin/python2.7   2         manual mode
    
    Press  to keep the current choice[*], or type selection number: 0
    
    
    root:~# python -V
    Python 2.7.12
    
    root:~# update-alternatives --config python
    There is only one alternative in link group python (providing /usr/bin/python): /usr/bin/python2.7
    Nothing to configure.
    

提交回复
热议问题