Hi, folks. CentOS 8 has been with us for a while now and some of its packages are starting to get old, including Python. In this post, I will show you how to install Python 3.9 on CentOS 8
Python is one of the most popular programming languages out there. Its incredible versatility makes it be in almost any technology field. In addition, its learning curve is quite low which makes it ideal for learning.
The truth is that CentOS 8 is in its best moment of stability, but also some of its packages are starting to get old. That’s why some people update some of them individually. Especially the most important ones for work.
Therefore, if a developer wants to take advantage of the features of Python 3.9 in CentOS 8, he has to update it.
So let’s go for it.
Install Python 3.9 on CentOS 8
By default, CentOS 8 includes Python but in an older version. So it’s time to upgrade.
So, open a terminal or connect to your server via SSH.
Then update the system completely:
sudo dnf update
In this post, I will use the sudo command to get root permissions so you need to have it.
Then install the necessary packages to compile packages on CentOS 8
sudo dnf groupinstall "Development Tools".
And also other necessary packages such as openssl-devel
sudo dnf install openssl-devel bzip2-devel libffi-devel
Now we can download the latest stable version of Python which is 3.9.2
with wget. If you don’t have it installed run:
sudo dnf install wget
Now proceed to download it in the /tmp/
folder.
cd /tmp/
wget https://www.python.org/ftp/python/3.9.2/Python-3.9.2.tgz
After that, decompress it
tar xvf Python-3.9.2.tgz
and access the generated folder:
cd Python-3.9*/
Before installing Python configure the source code
./configure --enable-optimizations
And you can install the Python package with the following command:
sudo make altinstall
And when finished, you can check the installation:
python3.9 -V
Python 3.9.2
So, enjoy it.
Conclusion
Python is very popular and many developers always want to have the latest to create their applications. That’s why it is often convenient to have the latest version of Python.