SSL module in Python is not available (on OSX)

后端 未结 7 1731
时光说笑
时光说笑 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:53

    Mac OSX Catalina (and same issue on OSX Mojave) Pyenv

    For anyone searching this topic, I had the same presenting problem, but had Python installed via both Homebrew and Pyenv!! It would have been better (IMO) to just use Pyenv to easily manage versions. As mentioned by @ivan_pozdeev in their answer, but here's some detail you might want.

    If your situation is similar, none of the above solutions would be quite enough to set things right. Partially I was helped by a Pyenv related answer here: https://stackoverflow.com/a/51797298/3084820 I also happened to have pyenv-virtualenv installed, so mentioning that as well, as it's common to use these two together.

    I finally took the following steps to resolve the issue:

    brew uninstall python
    rm -rf $(pyenv root)
    brew uninstall pyenv-virtualenv   # you may not have this installed, but...
    brew uninstall pyenv
    

    Now, for a clean installation manageable with Pyenv:

    brew install pyenv
    pyenv install 3.6.10  (or whatever version you want)
    

    This gave me a clean, working install of Python 3.6.10, and if I wanted or needed to, I could install a different version and switch between with Pyenv.

提交回复
热议问题