Python released its latest stable version – Python 3.10 – on October 04, 2021. This is icing on the cake after marking its 30th anniversary earlier this year. The latest Python upgrade offers an array of several new features which enhances user experience and functionality.
In this tutorial, we walk you through the installation of Python 3.10 on Rocky Linux 8.
Step 1: Install dependencies
First, it’s prudent that we begin by refreshing the software packages and repositories on Rocky Linux as shown.
$ sudo dnf update
Once done, install the dependencies including the GCC compiler which will be needed in compiling the source code.
$ sudo dnf install wget make gcc bzip2-devel openssl-devel zlib-devel libffi-devel
Step 2: Download Python 3.10.0 source file
The next step is to download the Python source code file. To do this, run the following command.
$ wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz
Once you have downloaded the compressed file, extract it. The file is quite small and the extraction process takes a very short time.
$ tar -xvf Python-3.10.0.tgz
Step 3: Install Python 3.10.0 on Rocky Linux 8
When the extraction is done, navigate to the uncompressed directory.
$ cd Python-3.10.0
And run the configuration script which performs a checklist to ensure that all the prerequisites are met before the installation begins.
$ ./configure --enable-optimizations
The –enable-optimizations option optimizes the Python binaries by running several tests, although it takes much longer to complete. Nonetheless this should take long, and you should be done within a minute or two.
To commence the build process, run the make command as follows. Here, the option denotes the -j flag of CPU cores. You can find out the number of CPU cores using the nproc command.
Back to building the source code. Run the make command
$ make -j 2
Here’s a sample of the output.
Lastly, compile the source code by running the following command:
$ sudo make altinstall
Once the compilation is complete, verify the Python version installed as follows.
$ python3.10 --version
From the output, we can confirm that Python has been successfully installed.
And this wraps up our guide. We have successfully installed Python 3.10 on Rocky Linux 8.
Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.