Home  »  How ToLibrariesProgrammingSoftwareTechnologyTools   »   How to Install Python 3.12 on Rocky Linux 8.10 Systems

How to Install Python 3.12 on Rocky Linux 8.10 Systems

Python is a powerful, versatile programming language widely used in various applications, from web development to data science. With the release of Python 3.12, many developers are eager to take advantage of its new features and improvements. This guide will walk you through the process of installing Python 3.12 on Rocky Linux 8.10.


Before you start, ensure you have:

  • A running Rocky Linux 8.10 system
  • A user account with sudo privileges
  • Internet access for downloading packages

Step 1: Update Your System

First, update your system to make sure all packages are up to date.

$ sudo dnf update -y

Step 2: Install Required Dependencies

To build Python from source, you need to install several development tools and libraries.

$ sudo dnf groupinstall -y "Development Tools"
$ sudo dnf install -y bzip2-devel openssl-devel libffi-devel xz-devel wget

Step 3: Download Python 3.12 Source Code

Download the Python 3.12 source code from the official Python website. You can use wget for this purpose.

$ cd /usr/src
$ sudo wget https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz

Step 4: Extract the Tarball

Extract the downloaded tarball.

$ sudo tar xzf Python-3.12.0.tgz
$ cd Python-3.12.0

Step 5: Compile and Install Python

Configure the script to prepare the build environment.

$ sudo ./configure --enable-optimizations

The --enable-optimizations option will optimize the Python binary by running multiple tests, making the build process slower but resulting in a faster Python interpreter.

Next, build and install Python.

$ sudo make altinstall

The altinstall option is used to prevent the new installation from overwriting the default Python binary.

Step 6: Verify the Installation

To verify the installation, check the Python version.

$ python3.12 --version

You should see an output similar to:

Python 3.12.0

Step 7: Set Up Virtual Environment (Optional)

It’s a good practice to use a virtual environment for your Python projects to manage dependencies separately. You can create a virtual environment using venv.

First, install the venv module if it’s not already installed.

$ sudo dnf install -y python3.12-venv

Create a virtual environment.

$ python3.12 -m venv myenv

Activate the virtual environment.

$ source myenv/bin/activate

Now, you can install packages within this isolated environment using pip.


You have successfully installed Python 3.12 on your Rocky Linux 8.10 system. This installation allows you to take advantage of the latest features and improvements in Python 3.12. Whether you are developing web applications, working on data analysis, or automating tasks, Python 3.12 provides a powerful and efficient platform for your projects.

For more information and further reading, check out the official Python documentation and the Rocky Linux documentation.

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.