How to Install Python 3.9 on CentOS 7

One of the most popular programming languages is Python, used in everything from low-level scripting to high-level application development. As of 2020, Python 3 has taken the place of its predecessor, Python 2. Python 3 can be installed on most modern operating systems, including Windows and CentOS. In this article, we will outline how to install Python 3.9 on CentOS 7.

Installing Python Package Manager PIP

  1. Before we can install the Python package manager, PIP, we need to enable additional software repositories using the following command:
    sudo yum install epel-release
  2. Next, install PIP using the following command:
    sudo yum install python-pip
  3. Finally, confirm that the installation was successful using the following command:
    pip --version
  4. If successful, the system should display the PIP version as well as your current Python version.

Installing Python 3.9 

Now that we have PIP installed, we can proceed with installing the latest version of Python, 3.9. 

  1. Before installing Python you will first need to install the requisite software packages using the following command: 
    sudo yum install gcc openssl-devel bzip2-devel libffi-devel zlib-devel
  2. Once that is done, download the latest version of Python using the wget command as follows:
  3. Once the file is downloaded, extract it using the following command:
    tar -xvf Python-3.9.6.tgz
  4. Once the file has extracted, move into the directory that was created and configure the installation using the following command:
    ./configure --enable-optimizations
  5. Next, build Python using the following command:
    sudo make altinstall
  6. After the installation process has finished, confirm the version using the following command:
    python3.9 --version

Congratulations, you have successfully installed Python 3.9 and PIP!

Trust your website to an industry leader in website hosting. Secure web hosting with InMotion Hosting and enjoy 99.99% uptime, 24/7/365 technical support, and risk-free money-back guarantee.

Alyssa Kordek Content Writer I

Alyssa started working for InMotion Hosting in 2015 as a member of the Technical Support team. Before being promoted to Technical Writer, Alyssa developed expertise in the fields of server hardware, Linux operating systems, cPanel, and WordPress. She now works to produce quality technical content featuring cutting-edge topics such as machine learning, data center infrastructure, and graphics card technology.

More Articles by Alyssa


  • Thank you very much. Just want to add that i didn’t understand the step 4 and stuck in it untill i moved into Python-3.9.6 directory.

    • Thanks for the feedback! I’m glad to hear that you found the article helpful and were able to sort out the confusion. We’ll review the wording on step 4 and see what we can do to make it a bit clearer for future readers.

Was this article helpful? Let us know!