Python is among the most popular programming languages today, known for its ease of learning, versatility, and a wide range of plugins.
Introduction
Python is among the most popular programming languages today, known for its ease of learning, versatility, and a wide range of plugins.
This guide will walk you through installing Python version 3.12 on AlmaLinux 9 and Rocky Linux 9.
1. Update the system
Start by updating your system to ensure it is up-to-date. Run the following command:
dnf update -y
2. Ensure Required Dependencies Are Installed
Install the necessary dependencies for building Python:
dnf install gcc openssl-devel bzip2-devel libffi-devel wget tar make -y
dnf groupinstall "Development Tools" -y
dnf install zlib-devel bzip2 readline-devel openssl-devel xz xz-devel tk-devel
gdbm-devel libuuid-devel libnsl2-devel -y
yum install sqlite-devel -y
3. Download Source Code
Run this command to download the Python source code:
cd /tmp
wget https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz
Then extract the archive:
tar -xf Python-3.12.0.tgz
4. Configure and Compile Python
Next, run the following commands to configure Python:
cd /tmp/Python-3.12.0
./configure --enable-optimizations
make
make altinstall
This will take some time.
5. Verify Python Installation
Check if Python 3.12 was installed successfully:
python3.12 --version
If it returns the correct version, the installation is successful:
Python 3.12.0