virtualenvwrapper.sh: There was a problem running the initialization hooks. If Python could not import the module virtualenvwrapper.hook_loader, check that virtualenvwrapper.........(解决办法)
Linux(ubuntu)上python2与python3共存环境下,安装virtualenvwrapper后, 其环境变量被自动设置为VIRTUALENVWRAPPER_PYTHON=/usr/bin/python
该地址指向Python2的解释器,现在更改成Python3就可以了,具体操作如下:
# 修改环境变量,重新载入
vim ~/.bashrc
在.bashrc文件中,删除原先的virtualenvwrapper配置,并追加以下内容
if [ -f /usr/local/bin/virtualenvwrapper.sh ]; then export WORKON_HOME=$HOME/.virtualenvs export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 source /usr/local/bin/virtualenvwrapper.sh fi
重新载入.bashrc
source ~/.bashrc
成功!