python
data_error
ai_generated
true
错误:无效的依赖项:'package == 1.0.0'
ERROR: Invalid requirement: 'package == 1.0.0'
ID: python/pip-install-error-invalid-requirement-whitespace
80%修复率
88%置信度
0证据数
2025-07-10首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.x | active | — | — | — |
根因分析
依赖项字符串在运算符周围包含空格,这在 pip 依赖项语法中是不允许的。
English
The requirement string contains spaces around the operator, which is not allowed in pip requirement syntax.
解决方案
-
99% 成功率
pip install package==1.0.0
-
95% 成功率
echo 'package==1.0.0' > requirements.txt && pip install -r requirements.txt
-
85% 成功率
Refer to pip's documentation on requirement specifiers.
无效尝试
常见但无效的做法:
-
90% 失败
Quoting does not fix the whitespace issue.
-
95% 失败
Newer pip still enforces no whitespace around operators.
-
95% 失败
Force reinstall does not bypass parsing.