I am working down a list of module dependencies for a django project I have inherited. I am setting up a local environment on a Windows 7 machine.
One of the first requirements is django==1.4.1, so I am installing this with pip, like this;
pip install -U django==1.4.1
This works fine. But when I get to some other items, like django-nose, and run
pip install -U django-nose==1.1
then I notice in the console output that it is updating my copy of django to 1.6.5
I can of course go back and backdate to django==1.4.1 afterwards, but I guess there is a reason for the update, and I'd like to understand it. I want my local environment to match the staging environment I am going to deploy to, is it ok to backdate my version, or is there a way of telling pip not to update django for me? Or is the newer version a requirement of the module I am installing?
The -U
switch tells pip
to upgrade the package and dependencies to their latest available version:
-U
Upgrade all packages to the newest available version. This process is recursive regardless of whether a dependency is already satisfied.
Emphasis mine.
django-nose
depends on nose
and Django
, so these are upgraded to their latest versions, you did not explicitly pin them.
Use --no-deps
if you don't want to upgrade dependencies:
pip install -U --no-deps django-nose==1.1
or better still, don't use -U
. You already pinned django-nose
, so the -U
switch is ineffective.
The switch -U
means: "Upgrade all packages to the newest available version. This process is recursive regardless of whether a dependency is already satisfied."
So you just forced the update yourself.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.