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.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Python installation queries.
In this context, we shall look into the installation process of Python 3.10 on Rocky Linux 8.
1. Install dependencies
First, it's prudent that we begin by refreshing the software packages and repositories on Rocky Linux with the below command:
$ 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
2. Download Python 3.10.0 source file
Here, you have 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:
$ tar -xvf Python-3.10.0.tgz
3. Install Python 3.10.0 on the system
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.
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:
$ nproc
Back to building the source code. Run the make command:
$ make -j 2
Finally, compile the source code by running the following command:
$ sudo make altinstall
Once the compilation is complete, verify the Python version installed with the below command:
$ python3.10 --version
From the output, you will confirm that Python has been successfully installed.
This article covers the process of installing Python 3.10 on Rocky Linux 8. In fact, Python is one of the most popular high-level languages, focusing on high-level and object-oriented applications from simple scrips to complex machine learning algorithms.