centos7编译安装Python 3.6.8 后用pip3出现SSL未配置问题(import ssl失败)解决方法
下载源码编译安装openssl
https://www.openssl.org/source/openssl-1.0.2j.tar.gz
./config --prefix=/usr/local/openssl
./config -t
./make && make install
下载源码编译安装python3.6.8
https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz
修改python3.6.8/Modules/Setup.dist文件
修改后为:
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