First of all, you want to open the Ubuntu 20.04 shell terminal application on Ubuntu 20.04 desktop. For that, you have to utilize the everlasting shortcut key “Ctrl+Alt+T” on the desktop of Ubuntu 20.04.
The shell application will be opened. Now, you have to check the version of a Python language already installed on your system. For this, you will be executing a version command of Ubuntu 20.04 with the keyword python. The command has been shown in the attached screenshot of the terminal. It clearly shows that any version of Python language is not configured in our system and we need to install it by ourselves. Many commands can be used.
So, we have to install the python version on our system supported by Ubuntu 20.04. Before that, we have to update our system. The apt package will be utilized in the update command to do so. The command is displayed in the image as well. The execution of this apt command leads us to enter the sudo password of our system. After adding the password, our system will update itself and its packages. The command and the process have been shown in the image.
It’s time to install the python old version on our system first. This is necessary to be done because we have to then update the python to the newest version after that. We have been installing Python version 2 on our system using the apt installation command displayed below.
After making the package ready, it will pause the process of installation for a while to ask us to affirm our action. It will let us know that 16.5 MB of space will be occupied by this package and if we want to continue installing it. So, we tapped “Y” to continue the installation process.
The installation process will start progressing. After it reaches 100 percent, it will be completed. Let’s just update the Linux system once again with the “apt” package.
After the successful installation of Python, we will be checking the version of python that has been installed. The version command has been used here once again as illustrated from the image below. We have used the “python2” keyword to check the installed version of Python 2.
When we have checked for the Python 3 versions on your system, it shows that the Python 3.8.2 version has also been installed with Python 2. While Python has come up with the Python 3.9 version as well. So, we need to upgrade this latest version to Ubuntu 20.04.
Let’s begin with the update of Python 3. First of all, you need to install all the required packages and repositories that are prerequisites for Python 3.9. Instead of listing all packages in the installation command, we have to just use the keyword “software-properties-common” in the instruction. We have done it in the command and the process has been started.
It will also pause the installation of required packages to affirm your action. It’s been informed that this process will take 14.3 kb of space on your system and do you want to continue it. So, we have added “y” and tapped the “Enter” button to start the process of installation.
The packages will be installed and configured on our system one by one and may take up to 5 minutes. The completion of this process has been shown in the small image below.
Before the installation of Python 3.9, you must have to add the “ppa” repository to your system. Without “ppa”, you will be unable to install Python 3.9. You need to use the “add-apt-repository” command of an apt package to do so. You have to use the “ppa:deadsnakes/ppa” keyword within your command with sudo privileges. Execute the command shown in the image below and it will set your system for new Python versions.
After a few seconds, the process of adding ppa will ask you to press the Enter button to start adding ppa requirements and packages i.e., prerequisites. we pressed Enter and the system installed the ppa package on our system. The output is shown in the attached photo.
Now, we cannot use the simple apt installation command with the keyword “python3.9” to install the latest python version. We have to install the Python environment variables and development interface with the keywords “python3.9-venv” and “python3.9-dev” as below.
Again, the system has been asking to tap “y” to affirm the action of installation as it takes 114 MB space on our Ubuntu system. We have tapped “y” and pressed the “Enter” key to continue.
The system has started upgrading the python. The process will take some to complete as it will also install the development environment along with the environment variables of Python 3.9.
After the complete installation, we have utilized it to check the Python version. We have found that the Python 3.9 latest version is now configured on our Ubuntu 20.04 system fully.
This article contains all the information and process regarding the update of Python in the Ubuntu 20.04 system. We have started from the very basics by installing the old version of Python on our system i.e., python2. Then, we have shown the way to update the Python version and upgrade it to version 3.9 by utilizing some commands. We hope you liked this article.