# centos 6.x
yum install net-tools openssl-devel zlib-devel readline-devel sqlite-devel gcc which nss-devel libcurl-devel bzip2 zlib-devel
# openssl
curl -O https://www.openssl.org/source/old/1.0.2/openssl-1.0.2u.tar.gz
./config shared zlib
make
make install # /usr/local/ssl
# python 3.6
curl -O https://www.python.org/ftp/python/3.6.10/Python-3.6.10.tgz
# edit Modules/Setup.dist
_socket socketmodule.c
SSL=/usr/local/ssl
_ssl _ssl.c
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl
-L$(SSL)/lib -lssl -lcrypto
export LDFLAGS="-L/usr/local/ssl/lib/"
export LD_LIBRARY_PATH="/usr/local/ssl/lib/"
export CPPFLAGS="-I/usr/local/ssl/include -I/usr/local/ssl/include/openssl"
./configure
make
make install
# /etc/ld.so.conf.d/openssl.conf
/usr/local/ssl/lib
$ python3
>> import ssl
>> ssl.OPENSSL_VERSION
'OpenSSL 1.0.2u 20 Dec 2019'
来源:oschina
链接:https://my.oschina.net/redhands/blog/3165751