我想让virtualenvwrapper运行。我安装它:
sudo pip install virtualenvwrapper
我像这样编辑了.bashrc:
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
export VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh
当我尝试运行“source~ / .bashrc”时,我收到此错误:
/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.
我在以下目录中安装了pip,python和virtualenv:
which python
/usr/bin/python
which pip
/usr/bin/pip
which virtualenv
/usr/local/bin/virtualenv
我究竟做错了什么?
您的错误发生是因为您为Python 2.7安装了virtualenv,但您尝试将其与Python 3一起使用。使用pip3在多版本系统上安装Python 3软件包。
pip uninstall virtualenvwrapper
pip3 install virtualenv virtualenvwrapper
你需要在你的source /usr/local/bin/virtualenvwrapper.sh
.bashrc
(你不需要导出它)。
我想你需要
pip3 install virtualenv virtualenvwrapper
并将其添加到〜/ .bashrc文件中
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
这是因为你的virtualenvwrapper指向python3。我刚刚解决了我的问题。感谢this help