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

后端 未结 28 1466
别跟我提以往
别跟我提以往 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:00

    for osx brew users

    my issue appeared related to my python installation and was quickly resolved by re-installing python3 and pip. i think it started misbehaving after an OS update but who knows (at this time I am on Mac OS 10.14.6)

    brew reinstall python3 --force
    # setup pip
    curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
    python3 get-pip.py
    # installa pkg successfully 
    pip install pandas
    
    0 讨论(0)
  • 2020-11-22 09:01

    On macos, configure python 3.8.1 with the command below will solve the problem, i think it would also work on Linux.

    ./configure --enable-optimizations --with-openssl=/usr/local/opt/openssl@1.1/
    

    change the dir parameter based on your system.

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

    If you are on Red Hat/CentOS:

    # To allow for building python ssl libs
    yum install openssl-devel
    # Download the source of *any* python version
    cd /usr/src
    wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
    tar xf Python-3.6.2.tar.xz 
    cd Python-3.6.2
    
    # Configure the build w/ your installed libraries
    ./configure
    
    # Install into /usr/local/bin/python3.6, don't overwrite global python bin
    make altinstall
    
    0 讨论(0)
  • 2020-11-22 09:04

    I finally solve this issue. These are the detail of my env:
    Version of Python to install: 3.6.8
    OS: Ubuntu 16.04.6 LTS
    Root access: No

    Some people suggest to install libssl-dev, but it did not work for me. I follow this link and I fixed it!
    In short, I download, extract, build, and install OpenSSL (openssl-1.1.1b.tar.gz). Then, I modify .bashrc file follow this link.
    Next, I download and extract Python-3.6.8.tgz. I edit Modules/Setup.dist to modify SSL path (lines around #211). I did ./configure --prefix=$HOME/opt/python-3.6.8, make and make install. Last, I modify my .bashrc. Notice that I do not include --enable-optimizations in ./configure.

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

    The problem probably caused by library missing.

    Before you install python 3.6, make sure you install all the libraries required for python.

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

    More information in How to Install Python 3.6.0 on Ubuntu & LinuxMint

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

    Downgrading openssl worked for me,

    brew switch openssl 1.0.2s
    
    0 讨论(0)
提交回复
热议问题