Hunsu Hunsu - 2 months ago 9
Python Question

Activating a virtual env not working

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


and I get this message :

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?

Answer

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

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