🌐
InMotion Hosting
inmotionhosting.com › inmotion hosting home › support › server technologies › linux › how to install python 3.9 on centos 7
How to Install Python 3.9 on CentOS 7 | InMotion Hosting
March 21, 2025 - Now that we have PIP installed, ... requisite software packages using the following command: sudo yum install gcc openssl-devel bzip2-devel libffi-devel zlib-devel...
🌐
TecAdmin
tecadmin.net › install-python-3-9-on-centos
How to Install Python 3.9 on CentOS/RHEL 7 & Fedora – TecAdmin
April 26, 2025 - 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. sudo yum install gcc openssl-devel bzip2-devel libffi-devel zlib-devel
Discussions

Trying to install python3.9 on CentOS 7
Just curious, why are you sticking with CentOS 7 instead of upgrading to CentOS Stream 9, Rocky Linux 9, RedHat EL 9 or Alma 9? More on reddit.com
🌐 r/CentOS
7
10
October 19, 2022
Install python 3.9 in linux server which is already having 2.7 without any side effect - Stack Overflow
My companies production linux server has python 2.7. Also, none of my colleagues know if anything is using python 2.7 on that machine. I want to use latest django on it so I want to install python ... More on stackoverflow.com
🌐 stackoverflow.com
On CentOS, how do I build Python 3.9 from source while incorporating my openssl module? - Stack Overflow
CentOS 7, Python3.9, OpenSSL1.1.1k (Packages Used) This method works for installing Python 3.9 (from source) while incorporating the OpenSSL socket module. OpenSSL package also installed from source (away from base OS / yum package install locations). More on stackoverflow.com
🌐 stackoverflow.com
Problem installing Python 3.9 RPM with yum on Centos 7
Is there a reason why you didn't start with the python3 SRPM in CentOS? More on reddit.com
🌐 r/linuxquestions
4
1
January 17, 2023
🌐
Medium
medium.com › @vivekpemawat › setting-up-python3-9-3f4373dccb92
Setting Up Python 3.9 on centos7: A Quick Guide - Vivek Pemawat - Medium
December 8, 2023 - sudo yum install wget wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz tar xzf Python-3.9.6.tgz cd Python-3.9.6 sudo ./configure --enable-optimizations sudo make altinstall · Note: Using make altinstall prevents Python 3.9 from ...
🌐
Reddit
reddit.com › r/centos › trying to install python3.9 on centos 7
r/CentOS on Reddit: Trying to install python3.9 on CentOS 7
October 19, 2022 -

I've tried a few didnt online guides but nothing seems to be helping me achieve what I'm looking for. I have a Linux machine for my network environment that I use for automation. I'm trying to upgrade my python 3.6.8 to some version of 3.9.x. I want to remove python 3.6.8, install 3.9, and then put 3.9 as the default for every user on the box.

Current Version of Linux 3.10.0-1160.6.1.el7.x86_64

I'm not a linux pro but I know some things.

🌐
ComputingForGeeks
computingforgeeks.com › home › install python 3.13 on rhel 10 / rocky linux 10 / almalinux 10
Install Python 3.13 on Rocky Linux / AlmaLinux [2 Methods]
March 24, 2026 - sudo yum install -y xz-devel cd Python-3.8*/ ./configure –enable-optimizations sudo make altinstall Reply · This procedure worked like a charm (I need to get off Python 3.6.8 ASAP but will be trapped on CentOS-7.9 for at least another year).
🌐
Oracle
docs.oracle.com › en › industries › communications › session-monitor › 5.1 › upgrade › installing-python39.html
Install Python3.9
October 9, 2023 - Note:When prompted, select the number corresponding to Python39 option and press the Enter key. Note:After the OCSM upgrade, while installing any new packages using yum, some packages install Python 3.6 as a dependency. As a result, Python alternatives are changed which can cause unexpected ...
🌐
TecAdmin
tecadmin.net › install-python-3-9-on-centos-8
How to Install Python 3.9 on CentOS/RHEL 8 – TecAdmin
April 26, 2025 - In this tutorial, we will guide you through the process of installing Python 3.9 on CentOS/RHEL 8 operating systems using the source archive file. This approach to installation provides greater control and customization, ensuring that you have the latest version of Python installed on your system. 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. sudo dnf install wget yum-utils make gcc openssl-devel bzip2-devel libffi-devel zlib-devel
Find elsewhere
🌐
Eldernode
blog.eldernode.com › linux vps › install python 3.9 on centos 8 & centos 7
How To Install Python 3.9 On CentOS 8 & Centos 7
November 8, 2020 - [root@centos7 ~]# python3 Python 3.9.0 (default, Nov 02 2020, 16:23:09) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> You should see the version of Python 3 installed on your system as well as a change in the command prompt characters. The simplest way of installing Python 3 is to use the Yum package manager, but if you want to have the most recent version of Python available, you should install a source in three required steps to reach this purpose:
Top answer
1 of 7
6

Python3.10 source build on CentOS 7.6

The above posts were very helpful to guide me to my solution. I want to share in case someone else could use this:

First the development libs

  1. sudo yum groupinstall "Development Tools" -y
  2. sudo yum install openssl11-devel libffi-devel bzip2-devel xz-devel -y
    • for static linking use openssl11-static

Then configure

So for some reason CentOS ships openssl1.1.1 but it is installed in a way that doesn't jive with Python's configure script.

# note that we #include <openssl/foo.h>, so the OpenSSL headers have to be in
    # an 'openssl' subdirectory

    if ! $found; then
        OPENSSL_INCLUDES=
        for ssldir in $ssldirs; do
            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openssl/ssl.h in $ssldir" >&5
$as_echo_n "checking for openssl/ssl.h in $ssldir... " >&6; }
            if test -f "$ssldir/include/openssl/ssl.h"; then
                OPENSSL_INCLUDES="-I$ssldir/include"
                OPENSSL_LDFLAGS="-L$ssldir/lib"
                OPENSSL_LIBS="-lssl -lcrypto"

Since Python is including headers a subfolder is desired: $ssldir/include/openssl/ssl.h

I just created a new folder with the correct layout:

/opt/openssl111/
├── include
│   └── openssl
│       └── *.h
└── lib
    ├── libcrypto.so
    └── libssl.so

Once in place, the trifecta:

  1. ./configure --enable-optimizations --with-lto --with-openssl=/opt/openssl111/
    • lto is link time optimization
  2. make -j8
  3. make altinstall (installs in /usr/local/ not to overwrite system python)
2 of 7
6

When you compile Python, you need to tell it which OpenSSL headers and libraries to use.

First, install openssl11-devel:

sudo yum install --assumeyes openssl11-devel

Second, before running "./configure" set CFLAGS and LDFLAGS from the values emitted by pkg-config

export CFLAGS="$CFLAGS $(pkg-config --cflags openssl11)"
export LDFLAGS="$LDFLAGS $(pkg-config --libs openssl11)"

Third, configure and build as normal:

./configure --prefix=/some/where/dir
   # ... etc ...

This is the most reliable way to get the correct flags passed to the compiler and linker. It's also worth checking that there aren't any conflicting values being passed into the CFLAGS / LDFLAGS environment variables, which might stymie your efforts.

This assumes that you have the openssl-devel package installed, obviously. :-)

🌐
Gcptutorials
gcptutorials.com › post › how-to-install-python3.9-on-centos
How to install Python3.9 on CentOS - gcptutorials
Master Biology, Chemistry, Physics, and English with interactive MCQs, calculators, tools, and worksheets. Free resources for students and exam preparation.
🌐
Amosplanet
amosplanet.org › install-python-3-9-9-on-centos7
Install Python 3.9.9 on Centos7 – amosplanet
yum install wget · tar -zxvf Python-3.9.9.tgz cd Python-3.9.9 ./configure make&&make install · mv /usr/bin/python /usr/bin/python.bak #删除以前python2.7的软连接 ln -s /usr/local/bin/python3 /usr/bin/python mv /usr/bin/pip /usr/bin/pip.bak (如果报错说没有pip直接跳过) 以下为没有此文件或目录报错 ·
🌐
Reddit
reddit.com › r/linuxquestions › problem installing python 3.9 rpm with yum on centos 7
r/linuxquestions on Reddit: Problem installing Python 3.9 RPM with yum on Centos 7
January 17, 2023 -

... but not rpm. Which has left me stumped.

I built Python 3.9.16 from source, and then packaged that as an RPM (using Gradle ospackage library).

./configure
make
make altinstall DESTDIR=${PWD}/fakeroot

If I try to yum install on Centos 7.9, I get a whole load of errors relating to python(abi) and it ultimately refuses to install as there's a requirement to uninstall system Python 2.7.

But if I rpm -i the same file, it installs no problem.

Querying the RPM I built (rpm -qlvp) there are no references to /usr/bin/python.

Why's Yum finding blocking dependencies and rpm is not?

SOLVED: Error/ignorance on my part!

When creating the RPM package, the following fields must be set exactly so:

  • Name: python3

  • Release: n.el7 (where n can be incremented to force Yum to treat it as an upgrade version)

I had "python" and "1" respectively... which I suspect rpm ignores, but Yum uses to work out the dependency chain, and my values were too ambiguous.

Changing them to the values above allowed me to install via yum with no errors whatsoever (and completely unaffecting the system installation of Python).

🌐
Red Hat
developers.redhat.com › blog › 2018 › 08 › 13 › install-python3-rhel
How to install multiple versions of Python on Red Hat Enterprise Linux | Red Hat Developer
February 27, 2024 - In addition, for installing the ... subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms $ yum group install "Development Tools"...
🌐
Vinod Pandey
vinodpandey.com › how-to-install-python3-on-centos-7
How to Install Python 3 on Centos 7 | Vinod Pandey
January 10, 2021 - In this tutorial we will install Python 3.6, 3.7, 3.8 & 3.9 on CentOS 7. The default python version in CentOS 7 is 2.7.5. If we forcefully upgrade or replace this version, yum and other utitiles may break causing the OS to become unstable. Instead of upgrading/replacing default python, we will install the new version of python using alternate install method. This setup will also install corresponding pip for each python version separately. ... python3.9 -V Python 3.9.1 pip3.9 -V pip 20.2.3 from /usr/local/lib/python3.9/site-packages/pip (python 3.9
🌐
GitHub
gist.github.com › xcsrz › 15c3d2509db3aada0d7c16bfb5b95f33
Install Python 3.9 on CentOS or Amazon Linux · GitHub
Install Python 3.9 on CentOS or Amazon Linux. GitHub Gist: instantly share code, notes, and snippets.
🌐
DEV Community
dev.to › hasone › installing-python3-alongside-the-default-python2-on-centos-rhel-4450
installing Python3 alongside the default python2 on CentOS (RHEL) - DEV Community
June 18, 2022 - We'll be using Source installation .../ftp/python/, in my case I'm gonna install 3.9 so here is the URL https://www.python.org/ftp/python/3.9.13/Python-3.9.13.tgz....
🌐
DevOpsSchool.com
devopsschool.com › blog › installing-python-3-on-linux-centos-ubuntu-windows
Python Tutorials: Installing Python 3 on Linux, Centos, Ubuntu & Windows
$ sudo ln -fs /usr/local/bin/python3.10 /usr/bin/python $ sudo ln -fs /usr/local/bin/python3.10 /usr/bin/python3 · yum update yum install openssl-devel bzip2-devel libffi-devel yum groupinstall “Development Tools” wget https://www.python.org/ftp/python/3.11.0/Python-3.11.0a4.tgz tar -xzf Python-3.11.0a4.tgz cd Python-3.11.0a4 ./configure –enable-optimizations make altinstall python3.11 -V
🌐
Cloudera
docs.cloudera.com › cdp-private-cloud-base › 7.1.9 › installation › topics › cdpdc-cm-install-python-39-rhel9-custom-location-xml.html
Installing standard Python 3.9 binary on RHEL 9 at a standard or custom location
July 19, 2024 - SSH into the host system on which you installed Python 3.9 as a root user. Open the /usr/lib/systemd/system/cloudera-scm-supervisord.service file for editing. Add the following line in the cloudera-scm-supervisord.service file under the [Service] section: Environment=”PYTHONBIN=[***CUSTO...