V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
caimaoy
V2EX  ›  问与答

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

  •  
  •   caimaoy · 2015-12-18 19:29:22 +08:00 · 6193 次点击
    这是一个创建于 3288 天前的主题,其中的信息可能已经有所发展或是发生改变。

    报错大概是这样的:

    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

    2 条回复    2017-08-28 18:01:53 +08:00
    julyclyde
        1
    julyclyde  
       2015-12-18 23:41:20 +08:00
    如果没有什么练手之类的需求,建议直接安装 epel 或者 scl 里的 python27
    yewang15215
        2
    yewang15215  
       2017-08-28 18:01:53 +08:00
    卸载旧版 openssl,重新安装新版
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1219 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 17:57 · PVG 01:57 · LAX 09:57 · JFK 12:57
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.