python
install_error
ai_generated
true
错误:无效的需求:'requests===2.31.0'
ERROR: Invalid requirement: 'requests===2.31.0'
ID: python/pip-invalid-requirement-double-equals
80%修复率
88%置信度
0证据数
2024-03-12首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
根因分析
需求字符串使用了三个等号,这不是有效的 PEP 440 版本说明符。pip 只支持 ==、>=、<=、~=、!=、<、>,而 ===(任意相等)要求与完整版本字符串精确匹配。
English
The requirement string uses three equals signs which is not a valid PEP 440 version specifier. pip only supports ==, >=, <=, ~=, !=, <, >, and === (arbitrary equality) requires exact string match against the full version.
解决方案
-
98% 成功率
pip install 'requests==2.31.0'
-
85% 成功率
pip install 'somepkg===1.0.0+localbuild'
无效尝试
常见但无效的做法:
-
75% 失败
The triple-equals syntax is valid PEP 440 but rarely what users want; upgrading pip does not change the parser's semantics.
-
90% 失败
Quoting is not the issue—the operator itself is wrong for the intent.