Fixing virtualenv after installing Mountain Lion
After installing Mac OS X Mountain Lion you may find that your Python virtualenv setup has broken. I saw a traceback ending in “IOError: [Errno 2] No such file or directory: ‘/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/__init__.py’”
Another error was being produced by virtualenvwrapper when trying to use the workon command: “ImportError: No module named virtualenvwrapper.hook_loader”
Fixing my virtualenv setup was pretty simple:
- Installed the XCode 4.4 Command Line Tools.
- Re-installed pip: sudo easy_install pip
- Re-installed virtualenv and virtualenvwrapper: sudo pip install virtualenv virtualenvwrapper
No other changes were needed and everything was running smoothly.