激活虚拟环境不起作用 [英] Activating a virtual env not working

查看:44
本文介绍了激活虚拟环境不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了两个 virtualenv 并安装了两个不同版本的 django.现在激活两个环境有问题,我是这样的:

I created two virtualenv and I installed two different versions of django. Now I have a problem to activate the two environment, I do like this :

source Django1.6/bin/activate

然后我看到环境被激活了.然后我做:

Then I see that the environment was activated. Then I do :

pip install django # for test

我收到这条消息:

Requirement already satisfied (use --upgrade to upgrade): 
                                 django in /usr/local/lib/python2.7/dist-packages

这表明环境未激活,但使用默认环境.为什么我得到这个?

This tell that the environment was not activated but it use the default one. Why I'm getting this?

推荐答案

当改变环境位置时,我们必须在新文件夹上执行 virtualenv.在寻找激活文件时,我发现了此代码:

When changing the environment location we must execute virtualenv on the new folder. When looking to activate file I have found this code :

VIRTUAL_ENV="/old/folder"
export VIRTUAL_ENV

当我们在新文件夹上执行 virtualenv 时,这个变量会更新.

This variable will updated when we execute virtualenv on the new folder.

这篇关于激活虚拟环境不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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