问题描述
我已经通过 apt-get 安装了 virtualenv 和 virtualwrapper,我已经到了创建虚拟环境的地步,但后来在同一天,当我使用 workon 命令时,它没有找到.我进一步检查了我的主目录和 .virtualenvs 目录以及我之前创建的 virtualenv 仍然存在......任何帮助将不胜感激.提前致谢.
I have installed virtualenv and the virtualwrapper via apt-get, I got to a point where I created a virtual enviroment but however later on during that same day when I used the workon command it was not found. I further on went and inspected my home directory and .virtualenvs dir and the virtualenv I created earlier were still there ...any help would be appreciated. Thanks in advance.
推荐答案
解决这个问题分两步:
将此添加到您的 .bashrc
/.bash_profile
/.zshrc
:
Add this to your .bashrc
/ .bash_profile
/ .zshrc
:
# load virtualenvwrapper for python (after custom PATHs)
venvwrap="virtualenvwrapper.sh"
/usr/bin/which -s $venvwrap
if [ $? -eq 0 ]; then
venvwrap=`/usr/bin/which $venvwrap`
source $venvwrap
fi
然后使用:
source .bash_profile
# or .bashrc / .zshrc
反映变化.
另外,如果终端有时还是找不到workon
,可以使用source .bash_profile
重新设置重新找到.
Additionally, if the terminal still sometimes cant find workon
, use source .bash_profile
to reset and find it again.
这篇关于Virtualenv:找不到工作命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!