Virtualenvwrapper Errors on Mac OS X Lion

I just upgraded my Mac from Snow Leopard to Lion. Then I needed to install virtualenv and virtualenvwrapper . I used for easy_install . I also added virtualenvwrapper parameters to the .bash_profile file as follows:

 # virtualenvwrapper settings export WORKON_HOME="~/virtualenvs" source "/usr/local/bin/virtualenvwrapper.sh" 

But when I search, I get the following error:

 ERROR: Could not create temporary file name. Make sure TMPDIR is set. virtualenvwrapper.sh: There was a problem running the initialization hooks. If Python could not import the module virtualenvwrapper.hook_loader, check that virtualenv has been installed for VIRTUALENVWRAPPER_PYTHON=/Library/Frameworks/Python.framework/Versions/2.7/bin/python and that PATH is set properly. 

Thank you all for your help.

+8
python osx-lion virtualenv virtualenvwrapper macos
source share
2 answers

Since /Library/Frameworks/Python.framework/Versions/2.7/bin/python is the path to a separately installed Python 2.7 (possibly from the python.org installer), and not the Apple Python 2.7 supplied ( /usr/bin/python2.7 ), you need to make sure that you use easy_install for this separate Python or change the use of Python supplied by Apple. To do this, you must ensure that your shell PATH variable is correct. In the first case, you must install easy_install by doing the following:

 cd /tmp curl -O http://python-distribute.org/distribute_setup.py sudo $VIRTUALENVWRAPPER_PYTHON distribute_setup.py 

You can fix your PATH shell to include the bin directory. If you use bash , one way would be to add this line to ~/.bash_profile :

 export PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}" 

Then open a new terminal session. You should now find that the easy_install that you just installed is correct:

 $ which easy_install /Library/Frameworks/Python.framework/Versions/2.7/bin/easy_install 
+13
source share

I had a similar problem and solved it by exporting $ TMPDIR to a cleaner path rather than the random shit that Mac OS X prefers.

 $ grep TMPDIR ~/.env export TMPDIR=/tmp/ $ source .env 

and now virtualenvwrapper can create its temporary files in order. To make the long story short, just add export TMP=/tmp/whatever to your shell configuration file (for example, for ZSH it is ~/.zsh , for bash it is ~/.bashrc ).

0
source share

All Articles