2

I needed a virtual environment with all the global packages included. I created one, and the global Django version is 1.3.1. Now, I need to upgrade the Django version to 1.4 only in my virtual environment. I switched to my environment by activating it, and tried

sudo pip install Django=1.4

It was installed,not in the virtual env but in the global dist-packages.

How to install a package only in the virtual environment?

3 Answers 3

2

After you switch to the virtual environment with the activate script. Just use pip install Django==1.4 no sudo needed.

Alternately you can use pip install -E=/path/to/my/virtual/env Django==1.4 in which case you don't need to switch to the virtual environment first.

Sign up to request clarification or add additional context in comments.

2 Comments

thanks! You saved my time, coz I practiced to install modules in server with sudo.
It got installed in my whole machine, not just in the virtualenv
2

If you just want to upgrade a package and don't know the version number you want to upgrade to you can use

pip install <package_name> --upgrade

in your virtualenv. So in your case above the following would work as well:

pip install django --upgrade

Instead of --upgrade just -U is also enough.

Comments

0

get your answer from

http://djangopaper.com/post/9334151791/install-multiple-django-version-using-virtualenvwrapper

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.