virtualenvwrapper.sh: There was a problem running the initialization hooks. If Python could not imp

Posted kisun168

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了virtualenvwrapper.sh: There was a problem running the initialization hooks. If Python could not imp相关的知识,希望对你有一定的参考价值。

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

 

成功!

技术图片

 

以上是关于virtualenvwrapper.sh: There was a problem running the initialization hooks. If Python could not imp的主要内容,如果未能解决你的问题,请参考以下文章

pip 安装后 virtualenvwrapper.sh 在哪里?

Where is virtualenvwrapper.sh after pip install?

virtualenvwrapper

CentOS7 安装虚拟环境 virtualenvwrapper

mac上安装virtualenvwrapper的正确姿势

python 虚拟环境 linux virtualenvwrapper