How to Install Python on CentOS 7

Install Python on CentOS 7

In this article, we will have explained the necessary steps to install and configure Python on CentOS 7. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Python is a powerful programming language. It is very friendly and easy to learn. Python is a quite versatile programming language, you can use it to do almost anything you want, write small scripts, build games, develop websites, create machine learning algorithms, analyze data, and more.

Install Python on CentOS 7

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo yum install epel-release
sudo yum update

Step 2. Install Python on the CentOS system.

First, Download Python using the following command from the Python official site:

tar xzf Python-3.7.4.tgz

Then enter into the new directory that was just created and compile Python source code on your system using altinstall:

cd Python-3.7.4
./configure --enable-optimizations
make altinstall

Confirm the installation and check the version of Python by entering the following command:

$ python3.7 --version
Python 3.7.4

That’s all you need to do to install Python on CentOS 7. I hope you find this quick tip helpful. For further reading on Python, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.