| To install Python 3.9 alongside Python 3.8 on CentOS 7, you can do this safely using either altinstall or environment managers like pyenv. Below is a detailed guide using the altinstall method (safe for keeping multiple versions side by side). Step 1: Install Required Build Dependenciessudo yum groupinstall "Development Tools" -y
sudo yum install gcc openssl-devel bzip2-devel libffi-devel wget make -y
Step 2: Download and Extract Python 3.9cd /usr/src
sudo wget https://www.python.org/ftp/python/3.9.18/Python-3.9.18.tgz
sudo tar xzf Python-3.9.18.tgz
cd Python-3.9.18
Step 3: Build and Install Python 3.9sudo ./configure --enable-optimizations
sudo make altinstall
❗ Use make altinstall (not make install) to avoid overwriting the default python binary.
Step 4: Verify Installationpython3.9 --version
Now you can use python3.8 and python3.9 independently. |