在requirements.txt中,代字号(〜=)是什么意思? [英] In requirements.txt, what does tilde equals (~=) mean?
问题描述
在我正在使用的Python库的requirements.txt
中,其中一项要求指定为:
In the requirements.txt
for a Python library I am using, one of the requirements is specified like:
mock-django~=0.6.10
~=
是什么意思?
推荐答案
这意味着它将选择软件包的最新版本,大于或等于0.6.10,但仍为0.6.*版本,因此它将不会. t例如下载0.7.0.如果软件包维护者遵守语义版本控制(它指出重大更改应仅在主要版本中进行,则可以确保获得安全修复程序,但保持向后兼容性).
It means it will select the latest version of the package, greater or equal to 0.6.10, but still in the 0.6.* version, so it won't download 0.7.0 for example. It ensures you will get security fixes but keep backward-compatibility, if the package maintainer respects the semantic versioning (which states that breaking changes should occur only in major versions).
或者,如PEP 440所述:
Or, as said by PEP 440:
对于给定的发布标识符V.N,兼容的发布子句近似等于一对比较子句:
For a given release identifier V.N , the compatible release clause is approximately equivalent to the pair of comparison clauses:
>= V.N, == V.*
- PEP 440中的定义
- 在此处的完整示例
- Definition in PEP 440
- Complete example here in the documentation
这篇关于在requirements.txt中,代字号(〜=)是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!