“ssl module in Python is not available” when installing package with pip3

后端 未结 28 1434
别跟我提以往
别跟我提以往 2020-11-22 08:51

I\'ve install Python 3.4 and Python 3.6 on my local machine successfully, but am unable to install packages with pip3.

When I execute pip3 install

相关标签:
28条回答
  • 2020-11-22 09:22

    Step by step guide to install Python 3.6 and pip3 in Ubuntu

    1. Install the necessary packages for Python and ssl: $ sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

    2. Download and unzip "Python-3.6.8.tar.xz" from https://www.python.org/ftp/python/ into your home directory.

    3. Open terminal in that directory and run: $ ./configure

    4. Build and install: $ make && sudo make install

    5. Install packages with: $ pip3 install package_name

    Disclaimer: The above commands are not tested in Ubuntu 20.04 LTS.

    0 讨论(0)
  • 2020-11-22 09:24

    I was able to fix this by updating the python version in this file. pyenv: version `3.6.5' is not installed (set by /Users/taruntarun/.python-version) Though i had the latest version installed, my command was still using old version 3.6.5

    Moving to version 3.7.3

    0 讨论(0)
  • 2020-11-22 09:25

    (NOT on Windows!)

    This made me tear my hair out for a week, so I hope this will help someone

    I tried everything short of re-installing Anaconda and/or Jupyter.

    Setup

    • AWS Linux
    • Manually installed Anaconda 3-5.3.0
    • Python3 (3.7) was running inside anaconda (ie, ./anaconda3/bin/python)
    • there was also /usr/bin/python and /usr/bin/python3 (but these were not being used as most of the work was done in Jupyter's terminal)

    Fix

    In Jupyter's terminal:

    cp /usr/lib64/libssl.so.10 ./anaconda3/lib/libssl.so.1.0.0

    cp /usr/lib64/libcrypto.so.10 ./anaconda3/lib/libcrypto.so.1.0.0

    What triggered this?

    So, this was all working until I tried to do a conda install conda-forge

    I'm not sure what happened, but conda must have updated openssl on the box (I'm guessing) so after this, everything broke.

    Basically, unknown to me, conda had updated openssl, but somehow deleted the old libraries and replaced it with libssl.so.1.1 and libcrypto.so.1.1.

    Python3, I guess, was compiled to look for libssl.so.1.0.0

    In the end, the key to diagnosis was this:

    python -c "import ssl; print (ssl.OPENSSL_VERSION)"

    gave the clue library "libssl.so.1.0.0" not found

    The huge assumption I made is that the yum version of ssl is the same as the conda version, so just renaming the shared object might work, and it did.

    My other solution was to re-compile python, re-install anaconda, etc, but in the end I'm glad I didn't need to.

    Hope this helps you guys out.

    0 讨论(0)
  • 2020-11-22 09:25

    I had the same issue trying to install python3.7 on an ubuntu14.04 machine. The issue was that I had some custom folders in my PKG_CONFIG_PATH and in my LD_LIBRARY_PATH, which prevented the python build process to find the system openssl libraries.

    so try to clear them and see what happens:

    export PKG_CONFIG_PATH=""
    export LD_LIBRARY_PATH=""
    
    0 讨论(0)
提交回复
热议问题