openssl - Going nuts: How to get python 3.7.6 installed on CentOS 7 - Stack Overflow
Cleanest way to install Python 3.7 on CentOS 7 image
Python 3.8 not possible to install on Linux? Why?
Trying to install python3.9 on CentOS 7
Videos
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
seeing your post i decided to stop trying to install 3.7 (already half an hour of head banging) and went for 3.6 using IUS. however, when i checked the version i had just installed, i saw this:
$ python3 -V
Python 3.7.4
so it looks like i got 3.7 even though this is the yum command i used:
$ yum install python36
anyway, it worked for me, perhaps it will work for you? a little bizarre, imo.
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