python
config_error
ai_generated
true
distutils.errors.DistutilsOptionError: 'extras_require' 选项错误:'foo' 必须是包含有效项目/版本要求说明符的字符串或字符串列表;无效说明符:'>=1.0, <2.0, !=1.5'
distutils.errors.DistutilsOptionError: error in 'extras_require' option: 'foo' must be a string or list of strings containing valid project/version requirement specifiers; Invalid specifier: '>=1.0, <2.0, !=1.5'
ID: python/setuptools-extras-require-parse-error
80%修复率
84%置信度
0证据数
2024-07-08首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
根因分析
extras_require 条目使用了已安装的 packaging/setuptools 无法解析的说明符集合,常由于多余空格、尾随逗号或重复/冲突的运算符。
English
An extras_require entry uses a specifier set the installed packaging/setuptools cannot parse, often due to stray whitespace, a trailing comma, or a duplicate/conflicting operator.
解决方案
-
95% 成功率
Simplify the specifier to a valid PEP 440 set, e.g. `'>=1.0,<2.0,!=1.5'` (no spaces, no trailing comma).
-
90% 成功率
Validate with `python -c "from packaging.specifiers import SpecifierSet; SpecifierSet('>=1.0,<2.0')"`.
无效尝试
常见但无效的做法:
-
85% 失败
Whitespace is not the issue; the specifier set itself is malformed.
-
75% 失败
Shifts the same parse error to a different field.