How to upgrade python 3.6 to 3.7 on Linux /Ubuntu/Lubuntu OS

It is easy to upgrade Python version for any linux distributions i.e Ubuntu, Lubuntu are among much popular linux distribution.

It is easy to be done just by following the steps below:

Step 1:
Run the commands below on your  linux terminal to check the current version of python3 running on your computer:

$ python3 --version

Output should be like below:

python 3.6.8

Step 2:
Install python3.7 by typing the commands below:

$ sudo apt update -y
$ sudo apt install python3.7

Step 3: Add python 3.6 & python 3.7 to update-alternatives:

$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2

Step 4: Update python 3 to point to python 3.7:

$ sudo update-alternatives --config python3

Output should be lite below:

user@ubuntu1804:~$ sudo update-alternatives --config python3
There are 2 choices for the alternative python3 (providing /usr/bin/python3).

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

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

Step 5: Test the new version of python3:

$ python3 -V

So version upgrade Done 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *