How To Install Python 3.11 on Rocky Linux 9

In this guide, we want to teach you How To Install Python 3.11 on Rocky Linux 9.

Python is a general-purpose object-oriented programming language. Unlike HTML, CSS, and JavaScript, it can be used for other types of programming, such as back-end development, software development, data science, and writing system scripts (automation), among other uses.

Steps To Install Python 3.11 on Rocky Linux 9

To complete this guide, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide on Initial Server Setup with Rocky Linux 9.

Installing Python 3.11 on Rocky Linux 9

First, you need to update your local package index with the following command:

sudo dnf update -y

Then, install the required packages and dependencies on your server with the command below:

sudo dnf install gcc openssl-devel bzip2-devel libffi-devel zlib-devel wget make tar -y

Download Python 3.11

Now you need to visit the Python Downloads page to check the latest stable version and download it with the following wget command:

sudo wget

Extract your downloaded file with the following command:

sudo tar -xf Python-3.11.1.tgz

Next, switch to your source directory:

cd Python-3.11.1

Run Configuration Script

At this point, you need to run the configuration script to be sure that all dependencies are ready for the Python 3.11 installation to work on Rocky Linux 9:

./configure --enable-optimizations

–enable-optimizations option is for use after all debugging and maximum performance with minimum run-time checks is required.

Build and Install Python 3.11

After the configuration script is completed, you need to start your build process with the following command:

make -j 2

The -j option is related to the number of cores in your system to speed up the build time.

To find how many cores you have on your system, you can use the following command:


The build process takes some time to complete.

When it is finished, you can install Python 3.11 source on Rocky Linux 9 with the following command:

sudo make altinstall

When your installation is completed, you can verify your Python 3.11 installation on Rocky Linux 9 by checking its version:

python3.11 --version
Python 3.11.1

To ensure that Python 3.11 is working correctly, you can create a test Python project.

Create a Test App with Python 3.11

First, you need to create the Python project directory and switch to it with the following command:

mkdir ~/test_app && cd ~/test_app

Then, from the project directory, create a virtual environment with the following command, here we named it test_app_venv:

python3.11 -m venv test_app_venv

Next, activate your virtual environment with the command below:

source test_app_venv/bin/activate

You will see that your shell prompts changes to the name of your virtual environment.

For example, you can install Apache-Airflow inside your virtual environment with the pip package manager for Python:

pip install apache-airflow

To exit from your virtual environment you can use the following command:



At this point, you learn to Install Python 3.11 on Rocky Linux 9 and create a test Python project.

I hope you enjoy it.

You may be like these articles:

How To Install WineHQ on Rocky Linux 9

Set up NTP Server and Client on Rocky Linux 9

Install CSF Firewall on Rocky Linux 9

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!