Install Python 3.8 on CentOS 7 / CentOS 8

Install Python 3.8 on CentOS 7 / CentOS 8

Step 1: Install Python Dependencies

As we’ll install Python from source, let’s install the packages required for Python installation.

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

Confirm gcc is available:

$ gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)

Step 2: Download latest Python 3.8 Archive

Now download the latest archive of Python 3.8 release.

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 created directory:

cd Python-3.8*/

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

Setup installation by running the configure script.

./configure --enable-optimizations

Initiate compilation of Python 3.8 on CentOS 7.

sudo make altinstall

If this was successful, you should get a message like below:

/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

Pip is also installed.

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

 

For any query or issue, feel free to discuss on http://discuss.eduguru.in