Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

django - pip install: How to force a specific package version

I'm trying to install Django 1.4.3, but when I execute pip install, pip keeps installing Django 1.5 version instead 1.4.3

sudo pip install -I Django==1.4.3

It returns:

Downloading/unpacking Django==1.4.3
  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.3, but installing version 1.5 <<<< ====
Installing collected packages: Django
  Found existing installation: Django 1.5
    Uninstalling Django:
      Successfully uninstalled Django
  Running setup.py install for Django

    warning: no previously-included files matching '__pycache__' found under directory '*'
    warning: no previously-included files matching '*.py[co]' found under directory '*'
    changing mode of /usr/local/bin/django-admin.py to 755
Successfully installed Django
Cleaning up...

but if I execute pip freeze, it keeps showing

Django==1.5

What am I doing wrong?

Thank you

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This could/should/can be helped by clearing the build dir for Django in pip. There is a bug for this, since version 1.1 see here for details

You can start checking for these folders here if you're on OS X or unix like systems:

~/.pip 
/tmp/pip-build-root (or pip-build-$USER, if you aren't running pip as root).

This is if you haven't specified a new build folder when you installed the first version of Django.

Good luck!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...