8

When trying to download django through:

sudo pip uninstall django

However, this downloads the new version of django 1.5. How would I force download version 1.4 through pip? Here is what I get when trying to install:

imac9:site-packages pdadmin$ sudo pip install django==1.4.1
Downloading/unpacking django==1.4.1
  Running setup.py egg_info for package django

    warning: no previously-included files matching '__pycache__' found under directory '*'
    warning: no previously-included files matching '*.py[co]' found under directory '*'
  Requested django==1.4.1, but installing version 1.5.1
Installing collected packages: django
    Found existing installation: Django 1.5.1
David542
  • 104,438
  • 178
  • 489
  • 842

2 Answers2

27

This can be done by using this command

sudo pip install django==1.4 #or any desired version.

should work.

NullPoiиteя
  • 56,591
  • 22
  • 125
  • 143
deadPoet
  • 528
  • 9
  • 22
  • Yes, though it still installs version 1.5. – David542 Apr 11 '13 at 20:03
  • 1
    if you already have 1.5 installed from earlier, manually remove it from `/dist-packages/` – karthikr Apr 11 '13 at 20:18
  • Take a look here, could be helpful http://stackoverflow.com/questions/9510474/removing-pips-cache – deadPoet Apr 11 '13 at 20:18
  • @David542, sorry i did't read before, but that traceback says that an updated version of django is already installed on your system. You should uninstall it before installing a previous version of the package. i don't think downgrading versions was contemplated in tools like pip, but otherwise is allowed. – deadPoet Apr 11 '13 at 20:46
  • @mmansilla how do I find out where the previous django packages are installed? I've deleted everything in site-packages, but still it seems it is still finding a previous version. – David542 Apr 11 '13 at 21:02
  • Are you using virtualenv to do any of this? That manages its own environment, which will be ignored when using sudo. Generally you would use either virtualenv, or sudo, but not both – nealmcb Dec 11 '16 at 04:51
1

Use this command :

pip install django=="1.7"

Administrator privilege may be required. If so then use it with sudo command.

Here the version is used 1.7 you should your required version.

You can also have a look at this tutorial : How to Install Django

Sadi
  • 366
  • 3
  • 6