Ok, here's what finally worked for me.

I think the key to success was updating LD_LIBRARY_PATH and PATH to include openssl as I went.

Install and build openssl.

OpenSSL 1.1.1d 10 Sep 2019

cloned openssl repo

Pulled out latest(?) 1.1 branch

git checkout OpenSSL_1_1_1d -b 1_1_1d

./config --prefix=/opt/openssl
make
make install

Add /opt/openssl/lib to your LD_LIBRARY_PATH env var

Add /opt/openssl/bin to your PATH

Install and build python-3.7.6

I installed with --prefix=/opt/python-3.7.6

./configure --prefix=/opt/python-3.7.6  --enable-optimizations --with-openssl=/opt/openssl
make
make install

Add /opt/python-3.7.6/lib to your LD_LIBRARY_PATH env var

Add /opt/python-3.7.6/bin to your PATH

Final Config

LD_LIBRARY_PATH=/opt/openssl/lib:/opt/python-3.7.6/lib:

PATH=/opt/openssl/bin:/opt/python-3.7.6/bin:/opt/idea/latest/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

Answer from SRJ on Stack Overflow
🌐
Google Groups
groups.google.com › g › vfx-platform-discuss › c › D-rdtZJV4nI
Python 3.7 on CentOS 7 (and 8)
On the other hand, yeah CentOS plan for getting to Python 3.7 is still not known ! But I see attempts of the same happening when searched on Internet (https://tecadmin.net/install-python-3-7-on-centos/)
🌐
GitHub
gist.github.com › wpupru › deda1cd96ea242d9a790e50cd0c97e9f
Install Python 3.7.0 on Centos 7 · GitHub
sudo su yum install -y wget gcc openssl-devel bzip2-devel libffi-devel zlib-devel xz-devel ; cd /usr/src; wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz ; tar xzf Python-3.7.0.tgz ; cd Python-3.7.0 ; ./configure --enable-optimizations ; make altinstall ; rm -rf /usr/bin/python3 ; ln -s /usr/local/bin/python3.7 /usr/bin/python3 ; python3 -V uname -a
Discussions

Cleanest way to install Python 3.7 on CentOS 7 image
Have you considered usinh the official Python 3.7 Docker image ? More on reddit.com
🌐 r/docker
7
1
July 10, 2019
python - How to install pip specifically for Python3 on CentOS 7? - Stack Overflow
CentOS 7 already has Python2.7.5 stock installed. I am doing an online course that requires Python3.x installed. So these are the following steps i took to install Python3.7.3.rc1 : $cd /usr/src $... More on stackoverflow.com
🌐 stackoverflow.com
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
python - Installing python3 on CentOS - Stack Overflow
I am using CentOS (CentOS Linux release 7.5.1804 (Core)) remotely (hosting my server that I would want to run python script on) which has python2 initially installed. I install python3 instead, ho... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Liquid Web
liquidweb.com › home › how to install python 3 on centos 7
Install Python 3 on CentOS 7: Easy Steps for Linux Users | Liquid Web
April 7, 2025 - Upgrade your CentOS 7 server to Python 3 with ease using our step-by-step guide featuring Yum and install Python3 Linux instructions.
🌐
Reddit
reddit.com › r/docker › cleanest way to install python 3.7 on centos 7 image
r/docker on Reddit: Cleanest way to install Python 3.7 on CentOS 7 image
July 10, 2019 -

I would think CentOS + Python would be extremely common but I can't find an elegant way to do this.

These both work, but they take minutes to run and bloat the image:

method #1:

FROM centos:7
RUN yum update -y && yum -y install yum-utils && yum -y groupinstall development && yum -y install https://centos7.iuscommunity.org/ius-release.rpm
RUN yum install -y python36u

method #2:

FROM centos:7
RUN yum -y --enablerepo=extras install epel-release && yum clean all && yum -y update
RUN wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz && tar xzf Python-3.7.2.tgz
RUN cd Python-3.7.2 && ./configure --enable-optimizations && make altinstall
🌐
Medium
medium.com › @CurtisForrester › installing-python3-in-centos-7-6-offline-69d45ca48054
Installing Python3 in CentOS 7.6 Offline | by C.R.Forrester | Medium
August 1, 2019 - For this I simply spun up a Docker container based on CentOS 7.6. (https://hub.docker.com/_/centos). I then set it up with the necessary packages to build Python from source. Any CentOS 7.6 build environment will do. sh-4.2# yum install -y ...
Find elsewhere
🌐
Readthedocs
fire-insights.readthedocs.io › en › latest › installation › python-install-linux.html
Python Installation on Linux - Redhat/CentOS — Sparkflows 0.0.1 documentation
python3.7 -m venv venv source venv/bin/activate python --version · Upgrade pip version with 20.0 or above: pip install pip --upgrade · Install development tool: yum install -y xz-devel · Install the CentOS SCL release file: yum install centos-release-scl ·
🌐
Medium
medium.com › @Ibraheemcisse › setting-up-python-3-7-development-environment-on-centos-7-server-c488807049bd
Setting Up Python 3.7 Development Environment on CentOS 7 Server | by Ibrahim Cisse | Medium
March 15, 2024 - I recently embarked on a journey to set up a Python 3.7 development environment on my CentOS server. Here’s a recount of the steps I followed: ... I began by accessing my CentOS server via SSH. After successfully logging in, I switched to the root user to perform administrative tasks. ... With administrative privileges, I installed the necessary development tools using the yum groupinstall command.
🌐
Centmin Mod
community.centminmod.com › threads › custom-python-3-7-3-8-3-9-3-10-rpm-builds-for-centos-7.22456
CentOS 7.x - Custom Python 3.7, 3.8, 3.9 & 3.10 RPM Builds For CentOS 7 | Centmin Mod Community Support Forums
February 5, 2022 - CentOS 7 by default uses Python 2.7 and has side by side install support up to Python 3.6 via YUM repository RPM packages. For Python 3.7 and higher,...
Top answer
1 of 3
6

You should have taken the default available python3, that is the python3.6 package in centos7 that would have been easier to setup rather than compile an unsupported version. Suggest you install the supported python3 package in centos

Try doing yum install python36 from repository

sudo yum install -y https://repo.ius.io/ius-release-el7.rpm

Update yum package

 sudo yum update

Install python36 along with pip

sudo yum install -y python36u python36u-libs python36u-devel python36u-pip

Below steps are for python3.7, suggest avoiding unsupported packages. Alternate Steps for pip setup for Centos You need to install pip for python3.7 series Step 1: First install the EPEL Repository

sudo yum install epel-release

Step 2: Installing pip

python37 -m pip

Step 3: Verify if pip was installed properly pip --version

If the command not found error shows up, try

python37 -m ensurepip
2 of 3
1

I also as you said "followed these steps religiously from this link: https://tecadmin.net/install-python-3-7-on-centos/."

It was not an option for me to install python3.6, as I explicitly needed 3.7. I was able to install using the following procedure:

# AFAIK, libffi-devel solved the "ModuleNotFoundError: No module named '_ctypes'" I had when I tried installing without it. 
yum install libffi-devel 

cd /usr/src
wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz
tar xzf Python-3.7.5.tgz
cd Python-3.7.5
./configure --enable-optimizations
make install  # Or: make altinstall
python3 -V
pip3 --version
rm -f /usr/src/Python-3.7.5.tgz

What I changed from the referenced article is the version (3.7.5 instead of 3.7.4) and in addition installed "libffi-devel". It could be that this one would have solved on 3.7.4 as well.

🌐
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.

🌐
Serverspace
serverspace.io › support › help › install-python-centos
How to Install or Upgrade Python on CentOS 7/8 Stream: Build the Latest Python from Source
February 16, 2026 - Learn how to install or upgrade Python on CentOS 7 and CentOS 8 Stream. Step-by-step guide to building the latest Python version from source, installing dependencies, and safely updating Python on a server.
🌐
Cloudera
docs.cloudera.com › cdp-private-cloud-base › 7.1.8 › installation › topics › cdpdc-install-python-3-centos.html
Installing Python 3.8 on CentOS 7 for Hue
January 18, 2024 - You must install Python 3.8 on ... Enterprise Linux (OEL) 7, CentOS 7, RHEL 7, then you must install Python 3.8 and then install the psycopg2-binary package for using PostgreSQL as a backend database for Hue....
🌐
Server Fault
serverfault.com › questions › 978812 › how-to-install-python3-using-yum-epel-release-on-centos7
linux - how-to install python3 using yum/epel-release on centos7 - Server Fault
Could you please advise how to install python36 using yum ? ... RHEL/CentOS 7 now includes python3 (version 3.6) in the base repositories.
🌐
AlexHost
alexhost.com › home › faq › comprehensive guide to installing python 3 on centos 7
Comprehensive Guide to Installing Python 3 on CentOS 7
October 7, 2024 - CentOS 7, renowned for its stability and reliability, is a preferred choice for server environments. However, it ships with Python 2.x by default, which is outdated for many modern applications that require Python 3. This guide provides a step-by-step process to install Python 3 on CentOS 7, ensuring your system is equipped to handle contemporary software requirements.
🌐
Medium
medium.com › @mrx04programmer › installing-any-updated-version-of-python-on-centos-7-8-or-arch-linux-563cabc8bb3c
Install any updated version python on centOS 7/8 | by mrx04programmer | Medium
August 16, 2023 - make install · ls /usr/local/bin/python* And if your version (example 3.8) is in that list, run the following command (Step 7of Simple way) export PATH=/usr/local/bin:$PATH · Python3 · Python · Arch · Linux · Centos · 2 followers · ·2 following · Help · Status ·
🌐
PhoenixNAP
phoenixnap.com › home › kb › devops and development › how to install latest version of python 3 on centos 7
How to Install Latest Version Of Python 3 on CentOS 7
November 10, 2022 - Python installation guide with easy step by step on how to install Python 3 on CentOS 7. This tutorial offers 2 install options, SCL Utility & Source Code.
🌐
RoseHosting
rosehosting.com › home › how to install python 3.6.4 on centos 7
How to Install Python 3.6.4 on CentOS 7 | RoseHosting
December 12, 2022 - sudo yum install -y python36u python36u-libs python36u-devel python36u-pip · Once these commands are executed, simply check if the correct version of Python has been installed by executing the following command: ... You have now finished installing Python 3.6.4 on your CentOS 7 machine, as well as installing a native Python package management tool called pip.