How to Install Python 3.12 on CentOS Stream 8

Python 3.12 is the newest major release of the Python programming language, and it contains many new features and optimizations.

Update Package Index

First, ensure your system is up-to-date by running,

dnf update

Install Dependencies

Install necessary packages to build Python from source,

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

Download Python 3.12 Source Code

Visit the Python downloads page to get the source code. Then, using wget, download the source,

cd /tmp
wget https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz

Now, Extract the Archive,

tar -xf Python-3.12.0.tgz

Configure and Compile Python

cd Python-3.12.0
./configure --enable-optimizations
make -j $(nproc)
sudo make altinstall

Verify Installation

Check if Python 3.12 has been installed successfully,

python3.12 --version

Output:

[root@vps Python-3.12.0]# python3.12 --version
Python 3.12.0
[root@vps Python-3.12.0]#

And that's it! You may now use Python 3.12 to develop software, build web apps, establish workflows, and more.


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