Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Virtualenvwrapper errors on Mac OS X Lion

I have just update my Mac from Snow Leopard to Lion. I then needed to install virtualenv and virtualenvwrapper. I used for both easy_install. I also added virtualenvwrapper settings to my .bash_profile file as following:

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

But when sourcing it 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.

like image 866
caruso_g Avatar asked Aug 03 '11 21:08

caruso_g


1 Answers

Since /Library/Frameworks/Python.framework/Versions/2.7/bin/python is the path to a separately-installed Python 2.7 (possibly from a python.org installer) rather than the Apple-supplied Python 2.7 (/usr/bin/python2.7), you need to make sure you are using an easy_install for that separate Python or change to using the Apple-supplied Python. To do either one, you should ensure that your shell PATH variable is correct. For the first case, you should be able to install an 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 up your shell PATH to include the framework bin directory. If you are using 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 easy_install you just installed is the right one:

$ which easy_install
/Library/Frameworks/Python.framework/Versions/2.7/bin/easy_install
like image 182
Ned Deily Avatar answered Oct 30 '22 18:10

Ned Deily