python
config_error
ai_generated
true
foo setup 命令错误:'install_requires' 必须是包含有效项目/版本需求说明符的字符串或字符串列表;无效需求,解析错误位于 "'bar >=1.0'"
error in foo setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Invalid requirement, parse error at "'bar >=1.0'"
ID: python/setuptools-install-requires-parse-error
80%修复率
87%置信度
0证据数
2024-08-14首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.x | active | — | — | — |
根因分析
install_requires 包含带有杂散字符或格式错误的版本操作符的无效说明符字符串。
English
install_requires contains an invalid specifier string with stray characters or malformed version operators.
解决方案
-
98% 成功率
Use valid PEP 440 specifiers: `install_requires=['bar>=1.0']` (no spaces around operators inside quotes).
-
95% 成功率
Run `python -c "from packaging.requirements import Requirement; Requirement('bar>=1.0')"` to test each string.
无效尝试
常见但无效的做法:
-
85% 失败
Older setuptools is stricter; the syntax error remains.
-
90% 失败
Breaks runtime dependencies for users.