Are you eager to unleash the power of the latest Python version on your RHEL 9 system? Follow this guide to install Python 3.12.8 and set it as the default version.
🚀 Download and Extract Python 3.12.8
wget https://www.python.org/ftp/python/3.12.8/Python-3.12.8.tgz
tar xzf Python-3.12.8.tgz
cd Python-3.12.8
🛠️ Install Dependencies and Update System
sudo dnf update -y
sudo dnf groupinstall "Development Tools" -y
sudo dnf install bzip2-devel expat-devel gdbm-devel ncurses-devel openssl-devel readline-devel sqlite-devel tk-devel xz-devel zlib-devel libffi-devel -y
🏗️ Configure and Build Python and Install
./configure --enable-optimizations
make -j$(nproc)
sudo make altinstall
🔄 Create Symbolic Links for Python and pip
sudo ln -sf /usr/local/bin/python3.12 /bin/python
sudo ln -sf /usr/local/bin/python3.12 /bin/python3
sudo ln -sf /usr/local/bin/pip3.12 /bin/pip
echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
✅ Verify the Installation
python --version
python3 --version
pip --version
pip install tqdm
🎊 Congratulations! You have successfully installed Python 3.12.8 on your RHEL 9 system and configured it as the default Python version. Happy coding! 💻✨