编译python

邮差的信 提交于 2020-02-26 13:52:20
# 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'
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!