OS X Lion上virtualenvwrapper的错误消息

bea*_*rdc 14 python homebrew virtualenv osx-lion

我已经使用自制软件在新的Mac Lion安装上安装python,并且一直试图用pip安装virtualenv和virtualenvwrapper,但是当我开始一个新的终端会话时,我得到了这个回溯:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named virtualenvwrapper.hook_loader
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.
Run Code Online (Sandbox Code Playgroud)

使用的python和pip来自自制软件,但它似乎要我使用Apple的默认python.我得到以下内容

~$ which python | xargs ls -l
lrwxr-xr-x  1 beard  admin  33 Jun 24 16:11 /usr/local/bin/python -> ../Cellar/python/2.7.3/bin/python
~$ echo $VIRTUALENVWRAPPER_PYTHON
/usr/local/bin/python
~$ which pip | xargs ls -l
-rwxr-xr-x  1 beard  admin  301 Jun 24 16:18 /usr/local/share/python/pip
~$ which virtualenvwrapper.sh | xargs ls -l
-rwxr-xr-x  1 beard  admin  32227 Jun 24 16:19 /usr/local/share/python/virtualenvwrapper.sh
Run Code Online (Sandbox Code Playgroud)

但是,它似乎认为我已经在系统python中安装了pip(和virtualenv) /usr/bin/python

编辑:在我的bashrc--

export WORKON_HOME="$HOME/py-env"
export VIRTUALENVWRAPPER_LOG_DIR="$HOME/py-env"
export VIRTUALENVWRAPPER_HOOK_DIR="$HOME/py-env"
source /usr/local/share/python/virtualenvwrapper.sh
export VIRTUALENVWRAPPER_PYTHON="/usr/local/bin/python"
Run Code Online (Sandbox Code Playgroud)

mun*_*nch 20

既然你有自己的python版本,你试过覆盖VIRTUALENVWRAPPER_PYTHON吗?(看起来你想要export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python)virtualenvwrapper文档建议在采购virtualenvwrapper.sh之前将envvar设置为所需的python.他们的例子有:

export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
source /usr/local/bin/virtualenvwrapper.sh
Run Code Online (Sandbox Code Playgroud)