Error when importing ssl in Python 3.7.4 on macOS 10.14.6

What fixed it for me on osx using homebrew was switching to an older version of openssl:

brew switch openssl 1.0.2s

See this SO article


I had exactly the same problem, which was solved once I upgraded my Python version to 3.7.6 using brew.

brew upgrade python3

This threw a permission denied error, but the update was done nonetheless, after which I was able to import ssl:

Python 3.7.6 (default, Dec 30 2019, 19:38:28) 
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>> ssl
<module 'ssl' from '/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py'>
>>> 

Tags:

Ssl

Python 3.X