SSL is not configured issue (import ssl failure) solution to occur with pip3 after centos7 compile and install Python 3.6.8

Download openssl source compiler installation

https://www.openssl.org/source/openssl-1.0.2j.tar.gz

./config --prefix=/usr/local/openssl

./config -t

./make && make install

Download the source code to compile and install python3.6.8

https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz

Modify python3.6.8 / Modules / Setup.dist file

After amended as follows:

204 # Socket module helper for socket(2)
205 _socket socketmodule.c
206
207 # Socket module helper for SSL support; you must comment out the other
208 # socket line above, and possibly edit the SSL variable:
209 SSL=/usr/local/ssl
210 _ssl _ssl.c \
211 -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
212 -L$(SSL)/lib -lssl -lcrypto
213

./configure --prefix=/usr/bin 

./make && make install

Guess you like

Origin www.cnblogs.com/zxpo/p/11078611.html