python
config_error
ai_generated
true
packaging.requirements.InvalidRequirement:预期结束或分号(在版本说明符之后) foo >= 1.0 < 2.0 ~~~~^
packaging.requirements.InvalidRequirement: Expected end or semicolon (after version specifier) foo >= 1.0 < 2.0 ~~~~^
ID: python/setuptools-invalid-version-specifier
80%修复率
89%置信度
0证据数
2024-04-23首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.x | active | — | — | — |
根因分析
版本约束组合了两个运算符而未使用逗号,例如 '>= 1.0 < 2.0'。PEP 440 要求说明符之间使用逗号。
English
A version constraint combines two operators without a comma, e.g. '>= 1.0 < 2.0'. PEP 440 requires a comma between specifiers.
解决方案
-
99% 成功率
# bad foo >= 1.0 < 2.0 # good foo>=1.0,<2.0
-
95% 成功率
# equivalent to >=1.0,<2.0 for a 1.x series foo~=1.0
无效尝试
常见但无效的做法:
-
90% 失败
Quoting does not change the grammar the parser enforces.
-
85% 失败
Older packaging also rejects the same malformed specifier.