Installing latest Python 3 on CentOS 7 system

Python is a well known, widely used and popular programming language for web applications. It often used on CentOS operating system. Currently most used CentOS version is 7.

But in fact by default CentOS 7 uses Python 2 (currently 2.7.5), and the most recent Python version is 3.8.2 (by the article date). We will have to setup the second version independently not to break yum packet manager and system components on our server.

Easy installation

1. Before we begin let’s update the packages. This will keep yum up to date:

[[email protected] ~]# yum update -y

2. Install Python 3 environment by run the ‘yum install’ command. It will install a Python 3 version, but please note it could be not very recent.

[[email protected] ~]# yum install -y python3

3. Verify Python version (to be sure it is installed and usable). Type in a terminal the following:

[[email protected] ~]# python --version

Experienced installation

Another installation procedure is described for programmers who like to get the most recent Python version. Not just a default Python environment for CentOS 7.

1. Add a repository SCL to the installation:

[[email protected] ~]# yum install centos-release-scl

2. Install desired Python version, for example:

[[email protected] ~]# yum install rh-python39

3. Get bash console for selected Python version (see previous step)

[[email protected] ~]# scl enable rh-python39 bash

4. Check Python version to be sure all steps were successful.

[[email protected] ~]# python --version

Looking for a custom solution?

Our technicians can provide you with the best custom made solutions on the market, no matter whether you're a small business or large enterprise.

Get in touch