How To Install Python 3.9 on CentOS 8

Install Python 3.9 on CentOS 8

In this tutorial, we will show you how to install Python 3.9 on CentOS 8. Python is an open-source and beginner-friendly programming language. Python 3.9 uses a new more flexible parser, based on PEG, which replaces the LL parser. In the next Python versions, the old parser will be deleted.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Python 3.9 on a CentOS 8.


  • A server running one of the following operating systems: CentOS 8.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo useror access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Python 3.9 on CentOS 8

Step 1. First, let’s start by ensuring your system is up-to-date and install all required dependencies.

sudo dnf install epel-release
sudo dnf update
sudo dnf install gcc openssl-devel bzip2-devel libffi-devel

Step 2. Installing Python 3.9 on CentOS 8.

Now we download Python from its official site using the following command:

cd /opt

Then, you must extract the downloaded archive:

tar xzf Python-3.9.0tgz

Next, we configure the source files based on your server or system environment:

cd Python-3.9.0 sudo
./configure --enable-optimizations
sudo make altinstall

After completing the installation steps, now check the installed versions of Python:

python3.9.0 -V

Step 3. Create Virtual Environment.

Nowadays Python virtual environment is a great tool and almost necessary for every Python project. It enables you to have more isolated Python spaces on one Linux box:

sudo /usr/local/bin/python3.9 -m venv /home/godetz/python-app/venv

All the files will be generated under /home/godetz/python-app/venv a directory. You can active the environment by running the command:

source /home/godetz/python-app/venv/bin/activate

Congratulations! You have successfully installed Python. Thanks for using this tutorial for installing Python 3.9 on CentOS 8 system. For additional help or useful information, we recommend you check the official Python website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!