python install_error ai_generated true

错误:无效的需求:'requests===2.31.0'

ERROR: Invalid requirement: 'requests===2.31.0'

ID: python/pip-invalid-requirement-double-equals

其他格式: JSON · Markdown 中文 · English
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.

generic

解决方案

  1. 98% 成功率
    pip install 'requests==2.31.0'
  2. 85% 成功率
    pip install 'somepkg===1.0.0+localbuild'

无效尝试

常见但无效的做法:

  1. 75% 失败

    The triple-equals syntax is valid PEP 440 but rarely what users want; upgrading pip does not change the parser's semantics.

  2. 90% 失败

    Quoting is not the issue—the operator itself is wrong for the intent.