我在使用mac安裝virtualwrapper的時候遇到了問題,搞了好長時間,才弄好,在這裏總結一下分享出來,供遇到相同的問題的朋友使用,少走些彎路。python
Mac默認系統的python2,而我本身用的是brew安裝的python3vim
下面是我安裝過程當中出現的問題bash
pip3 install virtualenv pip3 install virtualenvwrapper
# Settings for virtualenvwrapper export WORKON_HOME=$HOME/.virtualenvs source /usr/local/bin/virtualenvwrapper.sh
source ~/.bash_profile
這時,出現了以下問題:app
/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 virtualenvwrapper has been installed for VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is set properly.
從報錯信息VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is set properly.
這一句話來看,是環境指向python2
的路徑,因此咱們只須要將這個環境變量修改成python3
的路徑便可。ui
vim ~/.bash_profile
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3
source ~/.bash_profile