This tutorial will help you to install Python 3.9 on CentOS/RHEL 7 & Fedora systems. We will compile Python from the source code.

Prerequisites

This Python installation required the GCC compiler on your system. Login to your server using ssh or shell access. Now, use the following command to install prerequisites for Python before installing it.

Step 1 – Download Python 3.9

Download Python using following command from python official site. You can also download the latest version in place of the specified below. Then, extract the archive file on your system: This will create a directory named Python-3.9.6 in the current directory.

Step 2 – Install Python 3.9 on CentOS

Change directory to Python-3.9.4 and use the following commands to compile Python source code on your system using altinstall. Now remove downloaded source archive file from your system

Step 3 – Test Python Version

Check the latest version installed of python using the below command

Conclusion

In this tutorial, you have learned to install Python 3.9 on CentOS 7 and Fedora systems using source code.