In this article, we will guide you to upgrade python 3.6 to python 3.7. Additionally, we will also show you to how you can switch between 3.6 and 3.7.
Step 1: Check the current version
Run the following command to verify the current version of python.
$ python3 --version
Output:
python 3.6.9
Step 2: Python 3.7 Installation
Run the following commands to install python 3.7
$ sudo apt update -y $ sudo apt install python3.7
Step 3: Add python 3.6 and 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: Pointing to python 3.7
Run the following command to point to python 3.7 (or 3.6)
$ sudo update-alternatives --config python3
Output:
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:
Use “2” to point to python 3.7 and use”1″ to point to python 3.6. The selection might be little bit different on your system.
Under the hood, it uses sym-links to point to the selected version of python.
Step 4: Check the python version
$ python3 --version
Congrats! You are done!