I get this error when I boot up terminal:
JavaScript
x
10
10
1
Last login: Thu Apr 9 19:49:08 on ttys001
2
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named virtualenvwrapper
3
virtualenvwrapper.sh: There was a problem running the initialization hooks.
4
5
If Python could not import the module virtualenvwrapper.hook_loader,
6
check that virtualenvwrapper has been installed for
7
VIRTUALENVWRAPPER_PYTHON=/Library/Frameworks/Python.framework/Versions/2.7/bin/python and that PATH is
8
set properly.
9
dhcp-128-189-78-23:~ user_me$
10
I need to “point” my virtual environment to the version of python I’m using.
How can I do this?
Advertisement
Answer
I had the same exact issue and updating my path didn’t help anything, nor did setting VIRTUALENVWRAPPER_PYTHON and VIRTUALENVWRAPPER_VIRTUALENV. This is because I was seeing this strange behavior when running my version of python:
JavaScript
1
8
1
$ /usr/local/bin/python
2
Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54)
3
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
4
Type "help", "copyright", "credits" or "license" for more information.
5
>>> import sys
6
>>> print sys.executable
7
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
8
I was able to fix everything by uninstalling python with brew, reinstalling python with brew, and forcing it to overwrite existing symlinks in /usr/local/bin.
JavaScript
1
10
10
1
brew uninstall --force python
2
brew install python
3
brew link --overwrite python
4
brew linkapps python
5
pip install --upgrade pip setuptools
6
sudo pip uninstall virtualenv
7
pip install virtualenv
8
sudo pip uninstall virtualenvwrapper
9
pip install virtualenvwrapper
10
Hopefully you were able to get past this issue when you encountered it six months ago. I wanted to post my solution in case others run in to the same issue and cannot solve it by setting their paths and env variables.