Virtualenvwrapper installation snow leopard python

2019-09-01 18:22发布

问题:

I am trying to configure virtualenvwrapper with django1.4. I am following this post and am trying to do what it says there:

Admin$ pip install virtualenvwrapper
Requirement already satisfied (use --upgrade to upgrade): virtualenvwrapper in /usr/local/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/lib/python2.7/site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): virtualenv-clone in /usr/local/lib/python2.7/site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): stevedore in /usr/local/lib/python2.7/site-packages (from virtualenvwrapper)

Admin$ export WORKON_HOME=$HOME/.virtualenvs
Admin$ export PROJECT_HOME=$HOME/Users/Admin
Admin$ source /usr/local/bin/virtualenvwrapper.sh
/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 virtualenv has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is
set properly.

Admin$ mkvirtualenv --python=python2.7 mynewenv
The executable /Users/Admin/python2.7 (from --python=/Users/Admin/python2.7) does not exist

Can anyone help me figure out how to get virtualenvwrapper set up on my osx snow leopard installation? Thanks so much for the help!

回答1:

It looks like you're trying to use python2.7, but you haven't told virtualenvwrapper about that. Try adding export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python2.7 (assuming that's where your python2.7 install is located) before source /usr/local/bin/virtualenvwrapper.sh - i.e.

Admin$ export WORKON_HOME=$HOME/.virtualenvs
Admin$ export PROJECT_HOME=$HOME/Users/Admin
Admin$ export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python2.7
Admin$ source /usr/local/bin/virtualenvwrapper.sh