Table of Contents
Let’s discuss various ways to update the Python on your PC.
Updating Python in Windows
The first step is to open the cmd and check the python version on the terminal by typing the following command.
In our case, it displays version 3.6.4 as follows
Update Python 3.6.4 to 3.9.0 in Windows
We intend to update Python from the current version 3.6.4 to version 3.9.0.
To do so, we access https://www.python.org/, the official website for Python, and go to the downloads section. Then choose windows from the sub-menu.
In this case, the first option is ideal from the available list because it indicates the “Latest Python 3 Release -Python 3.9.0”. I click on the hyperlink, which presents various distributions of Python 3.9.0.
I select the windows X86-64 executable installer.
Running the executable file
After the download process is complete, I open it, and I am prompted by the question, “Do you want to run this file?”
I choose the option run, which presents a second interface.
The window presents two alternatives to upgrade to Python 3.6.4 (64-bit). The first option will maintain my already existing settings when it upgrades now.
The second alternative that is more flexible allows me to customize by enabling or disabling certain features.
Select the more comfortable option, which is “Upgrade Now.” What follows is the installation process that will appear as shown below.
When the installation is successful the following window will appear.
Click on the windows button and type in Python, press enter. The subsequent window presents the latest updated version of Python, as shown below.
And that is how simple it is.
Upgrade Python 3.8 to 3.9 Ubuntu
Adding Python 3.9.2 to the repository
The Latest Python 3.9.2 is not already available in ubuntu’s default repositories. Thus, it calls for additional storage.
We will use the dead snakes repository known for python packages on the launchpad.
How to Add dead snakes repository to ubuntu
sudo add-apt-repository ppa:deadsnakes/ppa
Then update the package list as follows
$ sudo apt-get update
How to verify the existence of the updated python packages list
To verify if the updated Python packages appear in the list, run the following command.
sudo apt list | grep python3.9.2
The output shows that Python 3.9.2 is now available for installation
How to install Python 3.9.2
First, add Python 3.9.2 to update-alternatives by running the following command.
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9.2
To change the default python 3.8 from pointing to python 3.8 because by default we want to execute python3.9.2, run the following command
sudo update-alternatives --config python3
Next is to check the current version of Python as follows
$ python3 -V
In our test, the results were as follows