Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install an old version of Django on virtualenv?

This may sound like a stupid question, since the very purpose of virtualenv is to this exactly: Installing some specific version of a package (in this case Django) inside the virtual environment. But it's exactly what I want to do, and I can't figure it out.

I'm on Windows XP, and I created the virtual environment successfully, and I'm able to run it, but how am I supposed to install the Django version I want into it? I mean, I know to use the newly-created easy_install script, but how do I make it install Django 1.0.7? If I do easy_install django, it will install the latest version. I tried putting the version number 1.0.7 into this command in various ways, but nothing worked.

How do I do this?

like image 510
Ram Rachum Avatar asked Jul 10 '10 17:07

Ram Rachum


People also ask

How do I install a specific version of Django?

If you want to install a specific Django version, then you use the exact same command but you add something at the end, which is you define the version that you want to use, so a double equal sign ( == ) and then a version number is going to make pip install that specific version of Django.

How do I downgrade Django version?

If you want to upgrade Django, then you can run pip install --upgrade django . If you would like to downgrade, then you can run pip install django==<versionnumber> . Replace <versionnumber> with the actual number, like 2.2.

Do I need to install Django in every virtual environment?

Basically Yes, you'll need to install django for each project when you are using virtual environment.


2 Answers

There was never a Django 1.0.7. The 1.0 series only went up to 1.0.4. You can see all the releases in the tags section of the Django code repository.

However to answer your question, don't use easy_install, use pip. (If it's not already installed, do easy_install pip, then never touch easy_install again). Now you can do:

pip install Django==1.0.4 
like image 128
Daniel Roseman Avatar answered Sep 23 '22 08:09

Daniel Roseman


+1 on the previous poster's reply: use pip if you can. But, in a pinch, the easiest way is to install an older version would be to download the tarball from the downloads page or, if you have subversion installed, do an svn export of the release you want (they are all tagged here).

Once you have the version of Django you want, just run the following command inside the django directory:

python setup.py install 

This will install that version of Django in your virtualenv.

like image 44
mazelife Avatar answered Sep 22 '22 08:09

mazelife