8

I just broke my environment because of django 1.3. None of my sites are able to run.

So, i decided to use virtualenv to set virtual environment with different python version as well as django.

But, seems like if i download the package and install using "sudo python setup.py install" this does not get added to my virtual environment, but my original environment.

I tried "easy_install django" in virtual environment virtualenv_name/bin folder, and it worked, but the problem is django1.3 was chosen automatically and got added.

I want to install django 1.2.5, is there a way that i can install easily to my virtual env?

CIF
  • 1,754
  • 2
  • 18
  • 30
  • dup http://stackoverflow.com/questions/3220280/how-do-i-install-an-old-version-of-django-on-virtualenv – dting Apr 16 '11 at 17:38
  • When using virtualenv, you generally shouldn't use sudo. When you use sudo, you leave your virtual environment far behind and work in the original environment as root. – nealmcb Dec 11 '16 at 04:47

3 Answers3

25

It's probably better to use Pip instead of easy_install.

Then make sure you create you virtualenv with the --no-site-packages-option.

For convenience you should consider using virtualenvwrapper in conjunction with virtualenv.

Check this introductory post to get an idea.

And finally make sure to specify the exact version you want to install. In your case try:

pip install django==1.2.5
Community
  • 1
  • 1
arie
  • 18,737
  • 5
  • 70
  • 76
5

Since the question was about easy_install, it's useful to know that (with setuptools v2.1) you can specify version numbers with easy_install like you can with pip. Thus:

$ easy_install django==1.3

will install django 1.3.

This was important for my problem (which Google directed me here to solve), when I needed to install an old version of pip with easy install. Obviously "just install pip and do it there" doesn't work for that problem.

Tim Saylor
  • 1,054
  • 2
  • 12
  • 19
0

This worked for me

$ mkvirtualenv foobar --no-site-packages
$ workon foobar
(foobar) $ pip install django==1.2.5

I have the virtualenvwrapper installed too. Unless you have virtualenvwrapper, the commands mkvirtualenv and workon will not work.

Praveen Gollakota
  • 37,112
  • 11
  • 62
  • 61