When trying to use any hg
Mercurial commands on the console, I keep getting this error.
I installed Python using Homebrew and I am running Mac OS Catalina v. 1
I had this issue recently (2020, May) with Google's GCP CLI. It also works on the obsolete Python 2.7.
This is a borked Python 2 installation problem. mBrew no longer correctly installs Python 2 gracefully, as no one cares about abondonware.
Conda still installs Python 2 in an environment; I did that.
When I would import hashlib I would see an error message stating that hash md5 was not found.
I was able to fix this problem by first unlinking openssl: brew unlink openssl
Then I uninstalled python 2.7 using MacPorts: sudo port uninstall python27
Then I installed python 2.7 using MacPorts: sudo port install python27
Now importing hashlib works :)
On macOS Mojave (10.14.6), this worked for me:
/usr/local/bin/python
and /usr/local/bin/pip
for python
and pip
binaries.My problem was having pyenv
installed and pointing to an old python 2 version
Uninstall python@2 (python2 was EOL since Jan 1st, 2020)
$ brew uninstall python@2
Uninstalling /usr/local/Cellar/python@2/2.7.15_1... (4,169 files, 76.0MB)
then
$ pyenv versions
system
* 2.7.12 (set by /Users/admin/.python-version)
3.4.5
3.7.7
$ pyenv local system
$ pyenv global system
Managed to fix this by first unlinking openssl
brew unlink openssl
And then reinstalling python
brew reinstall python@2
I also noticed that when running 'brew doctor' there was a warning related to an openssl folder found in /usr/local/include/node/. I deleted this folder before running the above commands (not sure if related)