Compiling Python with SSL Support from the Source on RHEL

##Install perquisites
yum groupinstall "Development Tools"
yum install openssl openssl-devel
yum install libffi-devel.x86_64

##download latest version of python-for example Python-3.6.4.tgz
tar -xzf Python-3.6.4.tgz
cd Python-3.6.4

##edit Modules/Setup.dist and comment out following lines: (lines:210,211,212)
vi Modules/Setup.dist

_ssl _ssl.c \
        -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
        -L$(SSL)/lib -lssl -lcrypto
		
##compiling python:
./configure --prefix=/usr/local/Python-3.6.4
make
make install
##testing ssl:
/usr/local/Python-3.6.4/bin/python3.6
Python 3.6.4 (default, May  9 2018, 12:23:25)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>>

Leave a Comment