ERROR: Could not find a version that satisfies the requirement my-package==2021.4.* (from versions: 0.0.2, 2021.4.1.dev44+gd452819a91.d20210528, 2021.5.26)
这看起来很奇怪,对吧?为什么列表中的第二个不匹配???
~=2021.4.1
也不起作用。 =~2021.4
安装 2021.5.26
我发现它起作用的唯一方法就是完整地拼写出来:==2021.4.1.dev44+gd452819a91.d20210528
为什么匹配运算符不起作用?
最佳答案
默认情况下,pip 会忽略预发布版本和开发版本。根据 pre-release versions 上的 pip 文档:
Starting with v1.4, pip will only install stable versions as specified by pre-releases by default. If a version cannot be parsed as a compliant PEP 440 version then it is assumed to be a pre-release.
If a Requirement specifier includes a pre-release or development version (e.g.
>=0.0.dev0
) then pip will allow pre-release and development versions for that requirement. This does not include the != flag.
如果您希望 pip 也将预发布版本和开发版本与版本说明符相匹配,您可以传递 --pre
调用pip install
时的标志:
关于python - Pip install 与包的开发版本不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67745900/