简体   繁体   English

python package 版本与本地版本 label

[英]python package version vs version with local version label

I'm using local version label as it is suggested in PEP440 , and I packaged 2 versions: turicreate-6.2 and turicreate-6.2+minimal .我正在使用 PEP440 中建议的本地版本label ,并且我打包了两个版本: turicreate-6.2turicreate-6.2+minimal

I first install turicreate 6.2+minimal ,我首先安装 turicreate 6.2+minimal

$ pip install target/turicreate-6.2+minimal-cp36-cp36m-macosx_10_12_intel.macosx_10_12_x86_64.macosx_10_13_intel.macosx_10_13_x86_64.macosx_10_14_intel.macosx_10_14_x86_64.whl

Then I try to install 6.2 and I hope pip can uninstall 6.2+minimal , but it says然后我尝试安装 6.2 我希望 pip 可以卸载6.2+minimal ,但它说

pip install turicreate==6.2
Requirement already satisfied: turicreate==6.2 in ./env36/lib/python3.6/site-packages (6.2+minimal)

I'm quite confused.我很困惑。 it treats version 6.2 and local version (redistribute version) 6.2+minimal as the same.它将版本6.2和本地版本(重新分发版本) 6.2+minimal视为相同。 But why?但为什么?

If I reverse the process, by installing 6.2 first and then 6.2+minimal , pip will uninstall 6.2 first.如果我颠倒这个过程,先安装6.2然后6.2+minimal , pip 将首先卸载6.2 It seems to be that pip treats these 2 versions differently.似乎 pip 对这两个版本的处理方式不同。

$ pip install target/turicreate-6.2+minimal-cp36-cp36m-macosx_10_12_intel.macosx_10_12_x86_64.macosx_10_13_intel.macosx_10_13_x86_64.macosx_10_14_intel.macosx_10_14_x86_64.whl
Processing ./target/turicreate-6.2+minimal-cp36-cp36m-macosx_10_12_intel.macosx_10_12_x86_64.macosx_10_13_intel.macosx_10_13_x86_64.macosx_10_14_intel.macosx_10_14_x86_64.whl
...
Requirement already satisfied: chardet<4,>=3.0.2 in ./env36/lib/python3.6/site-packages (from requests>=2.9.1->turicreate==6.2+minimal) (3.0.4)
Installing collected packages: turicreate
  Attempting uninstall: turicreate
    Found existing installation: turicreate 6.2
    Uninstalling turicreate-6.2:
      Successfully uninstalled turicreate-6.2
Successfully installed turicreate-6.2+minimal

PEP 0440 states the following:PEP 0440声明如下:

Except where specifically noted below, local version identifiers MUST NOT be permitted in version specifiers, and local version labels MUST be ignored entirely when checking if candidate versions match a given version specifier.

Which in your case means that you want to install 6.2 , pip finds existing 6.2+minimal , the local part +minimal is ignored because that's the way it should be, so pip is happy it doesn't need to do stuff.在您的情况下,这意味着您要安装6.2 , pip 发现现有的6.2+minimal ,本地部分+minimal被忽略,因为它应该是这样,所以 pip 很高兴它不需要做任何事情。 You're not happy because that's not what you want, though...你不快乐,因为那不是你想要的,虽然......

Going the other way around, my guess is that you're specifying a particular (local) version, which the 6.2 does NOT match, so pip does it.反过来说,我的猜测是你指定了一个特定的(本地)版本, 6.2不匹配,所以 pip 做到了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM