caimaoy
V2EX  ›  问与答

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

  •  
  •   caimaoy · Dec 18, 2015 · 6905 views
    This topic created in 3819 days ago, the information mentioned may be changed or developed.

    报错大概是这样的:

    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 replies    2017-08-28 18:01:53 +08:00
    julyclyde
        1
    julyclyde  
       Dec 18, 2015
    如果没有什么练手之类的需求,建议直接安装 epel 或者 scl 里的 python27
    yewang15215
        2
    yewang15215  
       Aug 28, 2017
    卸载旧版 openssl,重新安装新版
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   975 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 20:12 · PVG 04:12 · LAX 13:12 · JFK 16:12
    ♥ Do have faith in what you're doing.