pip:升级包,而不升级特定依赖 [英] pip: upgrade package without upgrading particular dependency

查看:911
本文介绍了pip:升级包,而不升级特定依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题非常类似于问题。但是它的方式不同,如果我正在安装一些包,我只想禁用特定依赖关系的升级而不是所有的依赖关系。我知道有一个标志 - no-deps ,但它会排除所有依赖关系,而不是我只想排除一个。

My question is very much similar to this question. But It differs in a way that if i am installing some package i only want to disable upgrade for a particular dependency not for all dependencies. I know there is a flag --no-deps but it will exclude all dependency rather i just want to exclude one.

这是一个场景:

  • I have Django 1.4 installed
  • I have django-rosetta installed

这里是 django-rosetta 最新版本中的依赖关系:

Here are django-rosetta dependencies in latest build:

install_requires=[
    'six >=1.2.0',
    'Django >= 1.3'
]

现在我想升级rosetta pip install -U django-rosetta 。但是它尝试下载并安装 Django 1.5 ,因为在rosetta依赖性 Django> = 1.3 是必需的(而且我不要这样做,因为Django 1.4已经安装)我只想要升级六个包,如果有的话。

Now i want to upgrade rosetta pip install -U django-rosetta. But it tried to download and install Django 1.5 because in rosetta dependency Django >= 1.3 is required (and i don't want it to do this as Django 1.4 is already installed) I only want it to upgrade six package if there is any.

- no-deps 标志将不起作用,因为它将排除包。另外我还没有使用虚拟环境。有任何建议吗?

--no-deps flag will not work as it will exclude six package also. Also I am not using virtual environment. Any suggestions please?

推荐答案

这样做可以让您更准确:

This works and lets you be more precise:

pip install -U django-rosetta Django==1.4

这篇关于pip:升级包,而不升级特定依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆