centos 6.5 编译安装 Python2.7 _ssl 模块编译失败

2015-12-18 19:29:22 +08:00
 caimaoy

报错大概是这样的:

running build
running build_ext
building dbm using gdbm
building '_ssl' extension
gcc -pthread -fPIC -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -I/usr/local/include -I/home/caimaoy/python_install/Python-2.7.10/Include -I/home/caimaoy/python_install/Python-2.7.10 -c /home/yuechen/python_install/Python-2.7.10/Modules/_ssl.c -o build/temp.linux-x86_64-2.7/home/caimaoy/python_install/Python-2.7.10/Modules/_ssl.o
gcc -pthread -shared build/temp.linux-x86_64-2.7/home/caimaoy/python_install/Python-2.7.10/Modules/_ssl.o -L/usr/local/lib -lssl -lcrypto -o build/lib.linux-x86_64-2.7/_ssl.so
*** WARNING: renaming "_ssl" since importing it failed: build/lib.linux-x86_64-2.7/_ssl.so: undefined symbol: SSL_CTX_set_alpn_protos

Python build finished, but the necessary bits to build these modules were not found:
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
openssl.i686                       1.0.1e-42.el6_7.1                 @updates   
openssl.x86_64                     1.0.1e-42.el6_7.1                 @updates   
openssl-devel.i686                 1.0.1e-42.el6_7.1                 @updates   
openssl-devel.x86_64               1.0.1e-42.el6_7.1                 @updates
Modules/Setup.dist 修改为如下

# 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

求如何编译成功 ssl

6199 次点击
所在节点    问与答
2 条回复
julyclyde
2015-12-18 23:41:20 +08:00
如果没有什么练手之类的需求,建议直接安装 epel 或者 scl 里的 python27
yewang15215
2017-08-28 18:01:53 +08:00
卸载旧版 openssl,重新安装新版

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/244543

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX