Get the Latest Python on Linux


Python is one of the most popular programming and scripting languages for all purposes. There are a number of tools you are working with that depends on Python. It’s so common and powerful that all the Linux distros come up with a pre-installed version of Python.

Today, let’s have a look at getting the latest version of Python in our Linux distro.

Installing Python

There are 2 available ways you can get Python – from the repo of the distro and building from the source. Some distros like Ubuntu, Debian, and Fedora etc. comes up with Python in their software repository. In the case of others, it’s the best to install Python from source.

Installing from distro repository

Run the following commands according to your Linux distro –

  • Ubuntu
sudo apt update && sudo apt upgrade -y

# Python 3
sudo apt install python3
sudo apt install python3.7

# Python 2
sudo apt install python

  • Debian
sudo apt-get install python3
  • OpenSUSE
sudo zypper install python3
  • Fedora
sudo dnf install python37
  • Arch Linux
sudo pacman -S python

Installing Python from source

At first, make sure that your system has all the required dependencies to build Python from source –

  • Ubuntu
sudo apt install make build-essential libssl-dev zlib1g-dev libbz2-dev



  • Debian
sudo apt-get install make build-essential libssl-dev zlib1g-dev libbz2-dev
  • OpenSUSE
sudu zypper install -t pattern devel_C_C++
  • CentOS
sudo yum update
sudo yum -y groupinstall development
sudo yum -y install zlib-devel

Now, download the latest source package of Python –


Extract the archive –

tar -xvf Python-3.7.0.tar.xz

Build the source –

./configure --enable-optimizations --with-ensurepip=install
make -j4
make test

Install the package –

sudo make altinstall

Testing Python

Depending on the version you installed, run the following command(s) to verify that Python is available system-wide.

python --version
python3 --version

Voila! Python is installed successfully!


Please enter your comment!
Please enter your name here