This post is to try and save someone the 15 minutes I stupidly wasted!
If you installed Python via Homebrew, it now names the python executable python2 (and similarly pip becomes pip2).
When you then try to install virtualenvwrapper you get the error:
1 2 3 4 5 6 7 |
/usr/bin/python: No module named virtualenvwrapper virtualenvwrapper.sh: There was a problem running the initialization hooks. If Python could not import the module virtualenvwrapper.hook_loader, check that virtualenvwrapper has been installed for VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is set properly. |
Links such as https://stackoverflow.com/questions/11507186/python-virtualenv-no-module-named-virtualenvwrapper-hook-loader are absolutely correct – they were just written before Brew changed the naming convention to python2.
The fix is super simple – set your .bash_profile/.bashrc as follows:
1 |
export VIRTUALENVWRAPPER_PYTHON=python2 |