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
🌐
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 ...
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
Cleanest way to install Python 3.7 on CentOS 7 image
Have you considered usinh the official Python 3.7 Docker image ? More on google.com
🌐 google.com
7
1
July 10, 2019
python - How to install pip specifically for Python3 on CentOS 7? - Stack Overflow
Nevertheless i did it and it gives ...n/python3.7: No module named pip . 2019-03-15T18:08:20.537Z+00:00 ... Thanks. Installing Python3.6 worked liked a charm with pip. 2019-03-15T18:14:19.397Z+00:00 ... Also sometimes python devel issue comes where we have to run yum install python-devel before running the above commands. 2019-11-18T09:53:36.957Z+00:00 ... For CentOS 6 Use : yum ... More on stackoverflow.com
🌐 stackoverflow.com
Python 3.8 not possible to install on Linux? Why?
It's nearly 2020 already, can we please move forward please. RHEL/Centos has a 6 years release cycle with 10 years maintenance support. Every package needs to work with every other package across the entire system... for the entire time. You cannot update any package without verifying first that you are not breaking anything in the process, and that takes resources, like time from people that knows what they are doing. And python 3.6 end-of-life is on 2021-12-23, we still have two years of full support. Besides... Why do you want to have python 3.8 system-wide? If you install a different version of a library as fundamental as python at a system level you are risking breaking packages or libraries on the whole system. I wonder what new feature is so necessary from python 3.8 that python 3.6 doesn't have that is so pressing for you to have it on your system immediately. I'm not sure what the deal is with Python enthusiasts or RHEL/CentOS users that someone somewhere has not simply updated some repo somewhere, I can try and get involved. Please do it, get involved. Learn. Fix. Document. Share. But a word of warning: tune it down a bit before going full-on whining again anywhere on both communities. More on reddit.com
🌐 r/Python
8
0
October 15, 2019
🌐
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 - Next, I installed the required dependencies for Python 3.7 to ensure that all necessary libraries and packages were available for the installation process. yum install -y libffi-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel ...
🌐
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
🌐
DEV Community
dev.to › mkalioby › install-python-3-7-on-centos-7-3i7b
Install Python 3.7+ on CentOS 7 - DEV Community
December 2, 2021 - This was my first time to install a recent version of Python on a CentOS. I always use Ubuntu and It is pretty easy using deadlysnakes PPA. so the only way was to compile the source code from python.org website. The how-to is on the internet but I'm writing this as I did compilation serveral times as some options weren't set properaly. so let's go · Install build tools sudo yum install gcc openssl-devel bzip2-devel libffi-devel
🌐
Vinod Pandey
vinodpandey.com › how-to-install-python3-on-centos-7
How to Install Python 3 on Centos 7 | Vinod Pandey
January 10, 2021 - Introduction 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.
🌐
OS Radar
osradar.com › home › linux › install python 3.7 on centos 7 and fedora 27/28
Install Python 3.7 on centos 7 and Fedora 27/28 - Linux Windows and android Tutorials
October 4, 2018 - #cd /root #wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz ... Use below set of commands to compile Python source code on your system using altinstall. ... #make altinstall -------------------------------------------- -------------------------------------------------------- if test "xupgrade" != "xno" ; then \ case upgrade in \ upgrade) ensurepip="--altinstall --upgrade" ;; \ install|*) ensurepip="--altinstall" ;; \ esac; \ ./python -E -m ensurepip \ $ensurepip --root=/ ; \ fi Looking in links: /tmp/tmpoolx9axs Collecting setuptools Collecting pip Installing collected packages: setuptools, pip Successfully installed pip-10.0.1 setuptools-39.0.1
Find elsewhere
🌐
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 - In order to install Python 3 from source, we are going to need to ensure that some prerequisite packages are installed on our system. [root@centos7 ~]# yum install gcc openssl-devel bzip2-devel libffi-devel -y
🌐
DevOpsSchool.com
devopsschool.com › blog › installing-python-3-on-linux-centos-ubuntu-windows
Python Tutorials: Installing Python 3 on Linux, Centos, Ubuntu & Windows
sudo yum -y install wget make gcc openssl-devel bzip2-devel cd /tmp/ wget https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgz tar xzf Python-3.7.9.tgz cd Python-3.7.9 ./configure --enable-optimizations sudo make altinstall sudo ln -sfn ...
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.

🌐
Sina's Blog
sinafathi.com › 2019 › install-python-3-7-on-centos-with-all-dependencies
Install Python 3.7 on CentOS with all dependencies - Sina’s Blog
August 13, 2019 - $ sudo yum groupinstall -y "Development Tools" $ sudo yum install –y gcc zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel tk-devel libffi-devel xz-devel gdbm-devel ncurses-devel db4-devel wget · Now that we installed ...
🌐
Dracula Servers
draculaservers.com › home › how to install python 3.x on centos 7
How to Install Python 3.x on CentOS 7 - Dracula Servers Tutorials
November 14, 2021 - In this tutorial we'll install Python 3.6 and Python 3.7 on a server running Centos 7 using 2 methods - from repositories & compiling from source.
🌐
Victordomingos
no-title.victordomingos.com › articles › 2020 › install_python_centos_linux › index.html
How to install the current Python version on CentOS Linux 7 | The No Title® Tech Blog
April 26, 2020 - You find out which development package provides that dependency. You install it using a package manager (for CentOS 7, it’s yum, but for other versions or other Linux distributions it could be dnf, apt-get or even other package managers).
🌐
Google
google.com › goto
Python 3.7 on CentOS 7 (and 8)
I'm currently working on adding support for Python 3.7 on Isotropix Clarisse.On Windows and macOS, the official Python installer is easy to download and use. But on CentOS 7, official Python binaries in repositories go up to 3.6, not 3.7.
🌐
Google
google.com › goto
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,...
🌐
Google
google.com › goto
Installing Python3 in CentOS 7.6 Offline | by C.R.Forrester | Medium
August 1, 2019 - While there will be a better way to bundle Python 3.7.4 (or just wait for the CentOS 8 release), this method allowed me to proceed with development and testing tasks. 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 epel-release sh-4.2# yum install -y gcc openssl-devel bzip2-devel libffi libffi-devel make wget