簡體   English   中英

為什么pip會根據python版本升級到不同版本?

[英]Why does pip upgrade to different versions depending on python version?

On mac, I pulled 4 images 2.9.0, 2.6.1, 2.4.0, 2.3.1 using docker run tensorflow/tensorflow:2.9.0-gpu python3 -m pip install -U pip and observed the changes in pip version.

  • 所有 4 個容器均以 pip 20.2.4 開頭。
  • 2.3.1 和 2.4.0 有 python 3.6.9 並且他們的點子升級到 21.3.1
  • 2.6.1 和 2.9.0 具有 python 3.8.10 並且它們的點數已升級到 22.2.2
  1. 當兩者都使用相同的python3 -m pip install -U pip時,為什么 21.3.1 和 22.2.2 之間存在這種差異?

  2. python 版本如何影響 pip 版本?

  3. 2.3.1 和 2.4.0 tensorflow 圖像也可以有 22.2.2 pip 嗎? 21.3.1 pip 導致ERROR: No matching distribution found for scipy==1.7.3 似乎有更少的可用 scipy 軟件包可供安裝。

我覺得我錯過了一些概念。 有人可以介紹它們,以及一些命令來調試/預測 python 版本將附帶/升級到 pip 版本嗎?

編輯

I just found a new way of debugging how pip works with verbose flag, so tried pip install -v scipy==1.7.3 using pip 21.3.1 and found out that different pips refer to the same index at https://pypi. org/simple/scipy/包含超過 1.5.4 的版本,這是 pip 21.3.1 在No matching distribution錯誤期間顯示為可用的最大版本。

我最初以為不同的 pip 版本可以訪問索引的不同部分,而 pip 21.3.1 沒有辦法看到 scipy 1.7.3。 Now it looks like any pip version can see the full list of versions for a package, but the versions have to go through python version compatibility checks to be installed.

The last line from the verbose install was Link requires a different Python (3.6.9 not in: '>=3.7'): https://files.pythonhosted.org/packages/4b/30/e15b806597e67057e07a5acdc135216ccbf76a5f1681a324533b61066b0b/pip-22.2.2.tar.gz#sha256=3fd1929db052f056d7a998439176d3333fa1b3f6c1ad881de1885c0717608a4b (from https://pypi.org/simple/pip/) (requires-python:>=3.7)

不知道為什么 url 中有一個pip-22.2.2.tar.gz 22.2.2.tar.gz。 前幾行也有更早的 pip 版本,讓我覺得整個逐項掃描不僅需要 python 版本,還需要 pip 版本?

原因是 Pip 22 不支持 python 3.6,因此您將獲得 python 3.6 的最新支持版本,因此您將獲得 Z62AD1C2A46C5298F3E2C95D3BABF8D0CDBBZ7577FCDDDEB74B4 的最新支持版本

Similarly, https://docs.scipy.org/doc/scipy/release.1.7.0.html says "This release requires Python 3.7+".

您似乎認為 pip 的版本決定了其他軟件包的版本(在您的情況下為scipy )可用於安裝,但這不是(完全)正確的。

所有包都可以有多個依賴項,通常它們不依賴於 pip,但主要依賴於 python 版本。

通常你可以看到 python 對 pypi 的依賴

例子:

https://pypi.org/project/scipy/1.5.3/需要Python >=3.6

https://pypi.org/project/scipy/1.7.3/需要Python >=3.7, <3.11

pip itself also has python version dependecies, that's why you cannot have pip 22.2.2 on Python 3.6 or lower.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM