How to install Python 3.8 on CentOS 7 / CentOS 8

In this guide, you will learn how to install Python 3.8 on CentOS 7 / CentOS 8. Python is a popular programming language originally created by Guido van Rossum and released in 1991. Python can be used to create web applications that handle big data. And perform complex math, system scripting, rapid prototyping and many other types of software development.

Install Python 3.8 on CentOS 7 / CentOS 8

Python runs on Windows, Mac, Linux, Raspberry Pi, BSD, and many other systems. At the time of this writing, the latest version of Python is Python 3.8.1. This is the version of Python we will install in this guide.

Step 1: Install Python dependencies

We will install Python from source, so please install the packages required for Python installation.

sudo yum -y groupinstall "Development Tools"
sudo yum -y install openssl-devel bzip2-devel libffi-devel

Confirm that gcc is available:

$ gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Step 2: Download the latest Python 3.8 archive

Download the latest archive for Python 3.8 now.

sudo yum -y install wget
wget https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz

Extract the package.

tar xvf Python-3.8.1.tgz

Change the directory created:

cd Python-3.8*/

Step 2: Install Python 3.8 on CentOS 7 / CentOS 8

Install the installer by running a configuration script.

./configure --enable-optimizations

Start compiling for Python 3.8 on CentOS 7.

sudo make altinstall

If successful, you will receive the following message:

/tmp/tmp9ly9eo2d/pip-19.2.3-py2.py3-none-any.whl/pip/_vendor/ipaddress.py:1106: SyntaxWarning: 'str' object is not callable; perhaps you missed a comma?
/tmp/tmp9ly9eo2d/pip-19.2.3-py2.py3-none-any.whl/pip/_vendor/ipaddress.py:1106: SyntaxWarning: 'str' object is not callable; perhaps you missed a comma?
Looking in links: /tmp/tmp9ly9eo2d
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-19.2.3 setuptools-41.2.0

Check the installation of Python 3.8 on CentOS 8 / CentOS 7.

$ python3.8 --version;
Python 3.8.1

Points are also installed.

$ pip3.8 --version
pip 19.2.3 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)

More information about Python:

Deploy a Python 3 Django application on CentOS 7 using Apache and mod_wsgi

How to install Python and Django on Debian

Best books to learn Python programming

Install Python 3 / Python 2.7 on CentOS 8 / RHEL 8

Sidebar