centos4.X 安装python2.7.X SSL模块

来源:互联网 发布:知悉和悉知是什么意思 编辑:程序博客网 时间:2024/05/16 12:00

源代码方式安装Python2.7.9

Python build finished, but the necessary bits to build these modules were not found:_bsddb             _tkinter           bsddb185        dl                 imageop            sunaudiodev     To find the necessary bits, look in setup.py in detect_modules() for the module's name.Failed to build these modules:_ssl                                                  

查看编译日志:

gcc -pthread -fPIC -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -I/usr/local/include -I/root/download/Python-2.7.9/Include -I/root/download/Python-2.7.9 -c /root/download/Python-2.7.9/Modules/_ssl.c -o build/temp.linux-x86_64-2.7/root/download/Python-2.7.9/Modules/_ssl.o/root/download/Python-2.7.9/Modules/_ssl.c: In function `_get_peer_alt_names':/root/download/Python-2.7.9/Modules/_ssl.c:801: warning: passing arg 2 of `ASN1_item_d2i' from incompatible pointer type/root/download/Python-2.7.9/Modules/_ssl.c:806: warning: passing arg 2 of pointer to function from incompatible pointer type/root/download/Python-2.7.9/Modules/_ssl.c: In function `PySSL_cipher':/root/download/Python-2.7.9/Modules/_ssl.c:1358: warning: passing arg 1 of `SSL_CIPHER_get_name' discards qualifiers from pointer target type/root/download/Python-2.7.9/Modules/_ssl.c:1368: warning: passing arg 1 of `SSL_CIPHER_get_version' discards qualifiers from pointer target type/root/download/Python-2.7.9/Modules/_ssl.c:1378: warning: passing arg 1 of `SSL_CIPHER_get_bits' discards qualifiers from pointer target type/root/download/Python-2.7.9/Modules/_ssl.c: In function `cert_store_stats':/root/download/Python-2.7.9/Modules/_ssl.c:3084: warning: implicit declaration of function `X509_check_ca'/root/download/Python-2.7.9/Modules/_ssl.c: In function `init_ssl':/root/download/Python-2.7.9/Modules/_ssl.c:3970: error: `X509_V_FLAG_X509_STRICT' undeclared (first use in this function)/root/download/Python-2.7.9/Modules/_ssl.c:3970: error: (Each undeclared identifier is reported only once/root/download/Python-2.7.9/Modules/_ssl.c:3970: error: for each function it appears in.)

由于centos4.9中的openssl版本较低:

[root@localhost Python-2.7.9]# yum list installed | grep opensslopenssl.i686                             0.9.7a-43.18.el4       installed       openssl.x86_64                           0.9.7a-43.18.el4       installed       openssl-devel.i386                       0.9.7a-43.18.el4       installed       openssl-devel.x86_64                     0.9.7a-43.18.el4       installed       xmlsec1-openssl.x86_64                   1.2.6-3.2              installed       xmlsec1-openssl.i386                     1.2.6-3.2              installed       

手工编译一份较新的:openssl-0.9.8e.tar.gz

然后修改Python2.7.9/Module/Setup
SSL修改为手工安装的路径即可

# Socket module helper for SSL support; you must comment out the other# socket line above, and possibly edit the SSL variable:SSL=/usr/local/ssl_ssl _ssl.c \-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \-L$(SSL)/lib -lssl -lcrypto
0 0
原创粉丝点击