PIP如何确定多个依赖项的依赖项版本 [英] How does PIP determine the version of a dependency of multiple dependents

查看:652
本文介绍了PIP如何确定多个依赖项的依赖项版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我们使用 PIP 作为软件包安装程序,在Python中具有以下依赖树:

Let's assume we have the following dependency tree in Python using PIP as package installer:

A==1.2.1:
|  - B==1.5.4
|  - C==?.?.?

D==1.3.0:
|  - C==?.?.?

我们还假设软件包C的现有版本如下:

Let's also assume that the existing versions of package C are the followings:

- 0.0.8
- 1.0.2

我们知道, PIP 不会将同一软件包的不同版本安装到环境.这意味着它必须为所有受抚养人选择一个合适的版本.

As we know, PIP will not install different versions of the same package into an environment. Which means it has to pick one suitable version for all dependents.

我根本无法理解PIP如何确定合适的版本.

What I simply cannot understand how PIP determines the suitable version.

如果程序包A依赖于C==0.0.8,而程序包D依赖于C==1.0.2,则这种情况很难得到解决,这与其他程序包管理器(如

If package A depends on C==0.0.8 and package D depends on C==1.0.2, this situation cannot get easily handled, unlike other package managers such as NPM could do.

推荐答案

当pip安装软件包时,它将自动安装任何相关的Python软件包,而无需检查这些软件包是否与以前安装的软件包冲突.它将安装软件包及其任何依赖项,而与现有安装的状态无关.因此,安装了有效的Google Tensorflow的用户可以发现,如果使用pip安装了与Tensorflow使用的版本不同的软件包,该软件包需要依赖NumPy库的版本有所不同,则该用户将无法正常工作.在某些情况下,该程序包似乎可以工作,但详细产生不同的结果.

Anaconda(Python发行版)-Wikipedia

这篇关于PIP如何确定多个依赖项的依赖项版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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