Virtualenv:找不到workon命令 [英] Virtualenv: workon command not found

查看:965
本文介绍了Virtualenv:找不到workon命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过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.

推荐答案

解决此问题需要两个步骤:

Solving this problem took two steps:

将此添加到您的.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:找不到workon命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆