SSL module in Python is not available (on OSX)

后端 未结 7 1717
时光说笑
时光说笑 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 20:04

    The ssl module as well as its underlying C extension appears to be a part of the python formula:

    Mac-Admin:~ admin$ python3
    Python 3.7.4 (default, Sep  7 2019, 18:27:02) 
    [Clang 10.0.1 (clang-1001.0.46.4)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import ssl
    >>> ssl
    <module 'ssl' from '/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py'>
    >>> import _ssl
    >>> _ssl
    <module '_ssl' from '/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_ssl.cpython-37m-darwin.so'>
    

    so it being missing most probably means package installation corruption which brew reinstall python should fix.


    Also note that while Homebrew allows multiple versions to coexist, its installation logic isn't quite designed to keep the alternative versions operational unless they are installed via a versioned formula (and e.g. routinely removes old versions in the regular brew cleanup).

    So consider using pyenv (also available via brew) if you need to routinely switch between Python versions -- or some 3rd-party tap that offers versioned formulae for it.

    0 讨论(0)
提交回复
热议问题