我使用 Homebrew 安装了 python 2和 3 。
$ which python
/usr/local/bin/python
$ which python3
/usr/local/bin/python3
$ which pip
/usr/local/bin/pip
$ which virtualenv
/usr/local/bin/virtualenv
$ which virtualenvwrapper.sh
/usr/local/bin/virtualenvwrapper.sh
下面是我的。bash_profile中的信息:
export PATH=/usr/local/bin:$PATH
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
每当我终端打开的时候都会报以下信息:
/usr/local/opt/python/bin/python2.7: 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 virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python and that PATH is
set properly.
因为我已经在 python 3上安装了 virtualenvwrapper 。 还需要在python2上安装它,解决方法如下
pip install virtualenvwrapper
网友评论