How to Install Python 3.10.5 on Rocky Linux 9

Python is an interpreted high-level general-purpose programming language. Its design philosophy emphasizes code readability with its use of significant indentation. Its language constructs as well as its object-oriented approach aim to help programmers write clear, logical code for small and large-scale projects.

First, check for any pending system updates,

dnf update

Install required packages.

dnf install gcc openssl-devel bzip2-devel libffi-devel zlib-devel wget make

Install Python 3.10.5

By default, Rocky Linux 9 comes with Python version 3.9

In this article, we will install the latest version of Python that is available, 3.10.5, on the Rocky Linux 9 system. You can check their official website to find the latest version available and download its source code.

wget https://www.python.org/ftp/python/3.10.5/Python-3.10.5.tgz 

Extract the downloaded file.

tar xzf Python-3.10.5.tgz 

Change to the extracted directory with the following command.

cd Python-3.10.5 

Run configuration command.

./configure --enable-optimizations 

Complete the Python installation on the Rocky Linux system by running the following command.

make -j 2

nproc

make altinstall 

Once the Python has been installed, confirm the version that is available by,

python3.10 --version

Output:

[root@server Python-3.10.5]# python3.10 --version
Python 3.10.5

Using pip on Python 3.10.5

Check the installed version of a pip by running the following command,

pip3.10 -V

Output:

[root@server ~]# pip3.10 -V
pip 22.0.4 from /usr/local/lib/python3.10/site-packages/pip (python 3.10)

CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS