LinTut

Install Python 3.8 on CentOS 8

Python is one of the most widely used programming languages in the world. With its simple and easy to learn syntax, Python is a popular choice for beginners and experienced developers. Python is quite a versatile programming language. It can be used to build all kinds of applications, from simple scrips to sophisticated machine learning algorithms.
At the writing time of this article Python 3.8 latest stable version is available to download and install. This article will help you to install Python 3.8.1 on your CentOS, Red Hat & Fedora operating systems.
This guide explains how to build Python 3.8 on CentOS 8 from the source code.

Installing Python 3.8 on CentOS 8

The first thing to do is to install the packages necessary to build Python from the source code on CentOS 8. To do so, run the following commands as root or sudo user:

# sudo dnf -y groupinstall 'development tools'
# sudo dnf -y install openssl-devel bzip2-devel libffi-devel

Download Python using following command from python official site. You can also download latest version in place of specified below.

# cd /opt
# cd /opt
# wget https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz

Now extract the downloaded package.

# tar xzf Python-3.8.1.tgz

Move to the Python directory.

# cd Python-3.8.1


Let’s start installation setup by running the configure script
# sudo ./configure --enable-optimizations
# sudo make altinstall

[box type=”note” align=”” class=”” width=””]make altinstall is used to prevent replacing the default python binary file /usr/bin/python.[/box]
On successful Installation you will see the similar output:

.........
rm -r /usr/local/lib/python3.8/lib-dynload/__pycache__
/bin/install -c -m 644 ./Misc/python.man \
        /usr/local/share/man/man1/python3.8.1
if test "xupgrade" != "xno"  ; then \
        case upgrade in \
                upgrade) ensurepip="--altinstall --upgrade" ;; \
                install|*) ensurepip="--altinstall" ;; \
        esac; \
         ./python -E -m ensurepip \
                $ensurepip --root=/ ; \
fi
Looking in links: /tmp/tmp8ii0zwgu
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-19.2.3 setuptools-41.2.0


Confirm the Installation of Python 3.8 on CentOS 8
# python3.8 --version

The output should show the Python 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)

Conclusion

We have shown you how to install Python 3.8 on your CentOS 8 machine.
If you have any questions or feedback, feel free to comment below.

Exit mobile version