我正在运行Mac OS 10.6.8。并希望除了python 2.6之外还安装python 2.7,并在新的virtualenv中使用python 2.7。我执行了以下步骤:
我下载并安装了python 2.7:
http://www.python.org/ftp/python/2.7.3/python-2.7.3-macosx10.6.dmg
然后,我运行命令使用python2.7设置新的virtualenv:
mkvirtualenv --python=python2.7 mynewenv
我的.bash_profile如下所示:
# needed for virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
source /usr/local/bin/virtualenvwrapper.sh
# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
现在,当我打开控制台时,出现以下错误消息。
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/local/bin/python and that PATH is set properly.
我还在另一篇文章中发现我应该升级virtualenvwrapper。那没有帮助。
sudo pip install virtualenvwrapper --upgrade
任何帮助,将不胜感激。
easy_install