Python3 ssl not available问题彻底解决

  • Post author:
  • Post category:python


Python3.7为例编译安装


首先,


No module named '_ctypes'

问题解决:

yum install  libffi libffi-devel


其次:


the ssl module in Python is not available

问题

  1. 安装libreSSL-2.8.3 下载-解压-configure-make-make install

  2. Python 3.7.0要求1.0.2q版本的openssl库 下载、解压 编译 安装

    ./config –prefix=/usr/local/openssl

    ./config -t

    make

    make install

  3. echo “/usr/local/openssl/lib” >> /etc/ld.so.conf.d/openssl.conf && ldconfig

  4. 打开ssl代码块儿 Python-3.7.0/Modules/Setup.dist

    SSL=/usr/local/openssl

    _ssl _ssl.c

    -DUSE_SSL -I



    (

    S

    S

    L

    )

    /

    i

    n

    c

    l

    u

    d

    e

    I

    (SSL)/include -I






    (


    S


    S


    L


    )


    /


    i


    n


    c


    l


    u


    d


    e













    I





    (SSL)/include/openssl

    -L$(SSL)/lib -lssl -lcrypto

  5. 重新编译Python

    ./configure –prefix=/opt/soft/python3 –enable-optimizations

    make

    make install

===========================================================

针对这个问题,只能采取最原始的办法来进行安装,具体操作如下;

(1)安装sqlite3的包

$ wget

https://www.sqlite.org/2017/sqlite-autoconf-3170000.tar.gz

–no-check-certificate

$ tar zxvf sqlite-autoconf-3170000.tar.gz

$ cd sqlite-autoconf-3170000

$ ./configure –prefix=/usr/local/sqlite3 –disable-static –enable-fts5 –enable-json1 CFLAGS=”-g -O2 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_RTREE=1″

=================

(2)对python3进行重新编译

$ cd Python-3.6.2

$ LD_RUN_PATH=/usr/local/sqlite3/lib ./configure LDFLAGS=”-L/usr/local/sqlite3/lib” CPPFLAGS=”-I /usr/local/sqlite3/include”

$ LD_RUN_PATH=/usr/local/sqlite3/lib make

$ LD_RUN_PATH=/usr/local/sqlite3/lib sudo make install



版权声明:本文为zongyue_wang原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。