Running brew reinstall python@2
didn’t work for my existing Python 2.7 virtual environments. Inside them there were still ERROR:root:code for hash sha1 was not found
errors.
I encountered this problem after I ran brew upgrade openssl
. And here’s the fix:
$ ls /usr/local/Cellar/openssl
…which shows
1.0.2t
According to the existing version, run:
$ brew switch openssl 1.0.2t
…which shows
Cleaning /usr/local/Cellar/openssl/1.0.2t
Opt link created for /usr/local/Cellar/openssl/1.0.2t
After that, run the following command in a Python 2.7 virtualenv:
(my-venv) $ python -c "import hashlib;m=hashlib.md5();print(m.hexdigest())"
…which shows
d41d8cd98f00b204e9800998ecf8427e
No more errors.