Building Python 3.7.1 - SSL module failed

前端 未结 6 1533
北荒
北荒 2020-12-02 21:31

Building Python 3.7 from source runs into following error:

Failed to build these modules:
_hashlib              _ssl                                     

Co         


        
6条回答
  •  情深已故
    2020-12-02 21:40

    I solved it after 3 days only because of this blog. with python 3.7.4 openssl 1.1.0 centOS 6.

    here is the summary :

    First, some prerequisites:

    sudo apt-get install build-essential checkinstall libreadline-gplv2-dev libncursesw5-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
    

    use yum instead of apt-get if using centos linux.

    Install ssl 1.0.2 or higher.

        cd /usr/src
        curl https://www.openssl.org/source/openssl-1.0.2o.tar.gz | tar xz
        cd openssl-1.0.2o
        ./config shared --prefix=/usr/local/
        sudo make
        sudo make install
    

    We will need to pass /usr/src/openssl-1.0.2o into the Python configure script.

    mkdir lib
    cp ./*.{so,so.1.0.0,a,pc} ./lib
    

    Now proceed with installing Python:

        cd /usr/src
        sudo wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
        sudo tar xzf Python-3.7.0.tgz
        cd Python-3.7.0
        ./configure --with-openssl=/usr/src/openssl-1.0.2o --enable-optimizations
        sudo make
        sudo make altinstall
    

    To test it out, run python3.7 and input:

    import ssl
    ssl.OPENSSL_VERSION
    

    Hope it helps!

提交回复
热议问题