Hi guys, today I am going to show you how to install the latest Python3 version (at the time of writing this post the current version is 3.10.2). In my example, I am going to use Ubuntu 20.04. Without further due, let's hop into the topic.
1. Update your Linux distro.
Before installing python3, make sure to update your Linux system.
sudo apt update && sudo apt -y upgrade
2. Adding Python archive to the apt manager.
After you have your system updated it is time to add the python archive to the apt manager. To do that we are going to need the required dependencies for adding custom archives. We are going to need software-properties-common
sudo apt install software-properties-common -y
After you have installed the required dependency, we are going to add the Personal Package Archive (PPA). You can read about PPA here.
sudo add-apt-repository ppa:deadsnakes/ppa
You will be prompted with a long text like this:
Just hit enter and python is going to be added.
Now you have added successfully the python archive to the apt
package manager and you can install the latest version using apt.
3. Installing the latest python version.
Now you have access to the python official versions. To install the latest just look up on the official python website the latest version, and install it like that:
sudo apt install python3.10
Congrats you have installed the latest python on your Linux distro.
To check the installation, just type the python you have installed and add after it
If you have any questions, leave a comment and I will answer as soon as possible.
Top comments (2)
apt is only available on Debian derivatives. This is certainly not "any distro."
Please note that the deadsnakes PPA is only tried and tested for LTS releases of Ubuntu, not for interims releases, not for Debian, and especially not for other distributions.