Python is a very well interpreted semantic used in computer programming. Not only is it diverse, but it’s also very simple and easy to use, implement, and learn from any programmer. It doesn’t take much time to learn and experience. You can use it in any operating system i.e. Windows and Linux. Python offers many versions that can be installed on our systems. So in this guide, we’re going to discuss the ways to update the old version of Python to the latest in the Ubuntu 20.04 operating system. So, let’s start to see it.
First, you want to open the Ubuntu 20.04 shell terminal application on the Ubuntu 20.04 desktop. To do this, you have to use the eternal key combination “Ctrl + Alt + T” on the Ubuntu 20.04 desktop.
The shell application will open. Now you need to check the version of a Python language that is already installed on your system. To do this, run a version command from Ubuntu 20.04 with the keyword python. The command was shown in the attached screenshot of the terminal. It clearly shows that no version of the Python language is configured in our system and we have to install it ourselves. Many commands can be used.
So we need to install the Python version on our Ubuntu 20.04 supported system. Before that we have to update our system. To do this, the apt package is used in the update command. The command is also shown in the picture. Executing this apt command will lead us to enter our system’s sudo password. After adding the password, our system and its packages will be updated. The command and process have been shown in the picture.
It’s time to install the old version of Python on our system first. This is necessary because we have to update the Python to the latest version afterwards. We installed Python version 2 on our system using the apt installation command shown below.
After the package has been made ready, the installation process will be paused for a while to ask us to confirm our action. It tells us that 16.5MB of disk space is being used by this package and whether we want to keep installing it. So we tapped “Y” to continue the installation process.
The installation process will continue. After it reaches 100 percent, it will be completed. Let’s just update the Linux system one more time with the “apt” package.
After successfully installing Python, we check the installed Python version. The version command has been used again here, as shown in the figure below. We used the keyword “python2” to check the version of Python 2 installed.
If we looked for the Python 3 versions on your system, it shows that the Python 3.8.2 version was also installed with Python 2. While Python also developed the Python 3.9 version. Hence, we need to update this latest version to Ubuntu 20.04.
Let’s start by updating Python 3. First, you’ll need to install all the required packages and repositories that are required for Python 3.9. Instead of listing all packages in the installation command, we just need to use the keyword “software-properties-common” in the instructions. We did it in the command and the process started.
It will also stop installing the required packages to confirm your action. It was told that this operation will take 14.3KB of space on your system and do you want to continue? So we added “y” and hit the “Enter” button to start the installation process.
The packages are installed and configured one after the other on our system and it can take up to 5 minutes. The completion of this process is shown in the small picture below.
Before installing Python 3.9, you need to add the “ppa” repository to your system. Without “ppa” you cannot install Python 3.9. To do this, you need to use the “add-apt-repository” command of an apt package. You must use the keyword “ppa: deadsnakes / ppa” in your command with sudo privileges. Run the command shown in the image below and your system will be set to new Python versions.
After a few seconds, when adding ppa, you will be prompted to press Enter to start adding ppa requirements and packages, that is, prerequisites. we hit enter and the system installed the ppa package on our system. The output can be seen in the attached photo.
Now we can’t use the simple apt install command with the keyword “python3.9” to install the latest version of Python. We need to install the Python environment variables and the development interface with the keywords “python3.9-venv” and “python3.9-dev” as described below.
Here, too, the system asked to tap “y” to confirm the installation action, as it requires 114 MB of storage space on our Ubuntu system. We tapped “y” and hit the “Enter” key to continue.
The system has started updating the Python. The process will take some time because the development environment will also be installed along with the Python 3.9 environment variables.
After the complete installation, we used it to check the Python version. We noticed that the latest version of Python 3.9 is now fully configured on our Ubuntu 20.04 system.
Conclusion
This article has all the information and the process to update Python in Ubuntu 20.04 system. We started with the basics by having the old version of Python installed on our system i.e. python2. Then we showed how to update the Python version and upgrade to version 3.9 by using some commands. We hope you enjoyed this article.