Low Orbit Flux Logo 2 F

Linux How To Install Python

We are going to show you how to install Python on Linux. If you are running Linux there is a good chance that you already have Python installed. Depending on your distro and how minimal your installation is there is a chance it may not necessarily have it. You may want a newer version. Many distros will include both Python 2 and 3. Some only include one of them. Whichever is installed it probably won’t be the absolute latest and greatest.

This should normally be able to use either of these to run Python 2 and 3:


python2
python3

This may point to either Python 2 or 3:


python

Install Python on Ubuntu / Debian

Both of these should already be installed but you can install Python 2 and 3 on Ubuntu / Debian like this:


sudo apt update
sudo apt install python2
sudo apt install python3

Install Python on Red Hat / RHEL / Fedora / Centos

You can install Python 2/3 on newer Red Hat / Fedora / CentOS systems like this:


sudo dnf install python2
sudo dnf install python3

And on older systems like this:


sudo yum update -y
sudo yum install -y python2
sudo yum install -y python3

Install Python on Arch Linux / Manjaro

Install Python 3 on Arch or Manjaro:


pacman -S python

Install Python 2 on Arch or Manjaro:


pacman -S python2

On Arch and Manjaro you can use the following commands to run Python 2 / 3.


python2    # run Python 2
python     # run Python 3

Install PIP on Linux

Pip is a standard tool that you will almost certainly want to have. It will allow you to install additional Python modules using the pip command.

You might already have it but if you need to install pip you should take a look at our other article Linux How to Install pip.

Build Python from Source

You might also want to build Python from source. We wrote another guide showing you how to do this here Build Python from Source on Linux.