Change default Python version (Obsolete)

Change to default python3 version on Raspberry Pi OS:

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 2

# check the list 

sudo update-alternatives --list python
/usr/bin/python2.7
/usr/bin/python3.7

# Change the default version

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.7   2         auto mode
  1            /usr/bin/python2.7   1         manual mode
  2            /usr/bin/python3.7   2         manual mode

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

# now Python 3 is default

python
Python 3.7.3 (default, Jul 25 2020, 13:03:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

Source: Change default python version on Raspbian GNU/Linux – LinuxConfig.org

Leave a Reply

Your email address will not be published.

Yandex.Metrica