Thursday, April 16, 2020

Update default Python on Debian


Welcome to Ubuntu 18.04.4 LTS (GNU/Linux 4.14.173-173 armv7l)

> root@hc1-node-1:~# update-alternatives --list python
update-alternatives: error: no alternatives for python

> root@hc1-node-1:~# python -V
Python 2.7.17

> root@hc1-node-1:~# update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
update-alternatives: using /usr/bin/python2.7 to provide /usr/bin/python (python) in auto mode

> root@hc1-node-1:~# update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2
update-alternatives: using /usr/bin/python3.6 to provide /usr/bin/python (python) in auto mode

> root@hc1-node-1:~# update-alternatives --install /usr/bin/python python /usr/bin/python3.7 3
update-alternatives: using /usr/bin/python3.7 to provide /usr/bin/python (python) in auto mode

> root@hc1-node-1:~# update-alternatives --list python
/usr/bin/python2.7
/usr/bin/python3.6
/usr/bin/python3.7


> root@hc1-node-1:~# update-alternatives --config python
There are 3 choices for the alternative python (providing /usr/bin/python).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /usr/bin/python3.7   3         auto mode
  1            /usr/bin/python2.7   1         manual mode
  2            /usr/bin/python3.6   2         manual mode
  3            /usr/bin/python3.7   3         manual mode

Press <enter> to keep the current choice[*], or type selection number:

> root@hc1-node-1:~# python -V
Python 3.7.5

No comments:

Post a Comment