SSL module in Python is not available (on OSX)

后端 未结 7 1722
时光说笑
时光说笑 2020-12-08 19:16

I\'m having trouble running pip install in a virtualenv on OSX 10.13. I already have run brew install openssl and the path /usr/local/include

7条回答
  •  眼角桃花
    2020-12-08 19:56

    This problem might also be, because your python distribution was compiled using the wrong version of openssl.

    Support for OpenSSL 1.1.x, was only added in Python 2.7.13, 3.5.3 and 3.6.0 (see https://github.com/pyenv/pyenv/issues/950#issuecomment-562366902)

    So if you are trying to install an older version of Python you must first uninstall the new version of openssl with brew and only then you can install an older version of Python with pyenv

    brew uninstall --ignore-dependencies openssl@1.1
    pyenv uninstall 3.5.2  # deinstall old versions compiled with the wrong version of openssl
    pyenv install 3.5.2
    

    On the other side, if you are trying to install newer version of Python make sure you have installed the latest version of openssl available, before you install them with pyenv:

    brew upgrade openssl
    pyenv uninstall 3.7.4 # deinstall old versions compiled with the wrong version of openssl
    pyenv install 3.7.4
    

提交回复
热议问题