python
config_error
ai_generated
true
mypkg setup 命令错误:'python_requires' 必须是包含有效版本说明符的字符串;无效说明符:'>=3.7.*'
error in mypkg setup command: 'python_requires' must be a string containing valid version specifiers; Invalid specifier: '>=3.7.*'
ID: python/setuptools-invalid-python-requires
80%修复率
88%置信度
0证据数
2024-08-27首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.x | active | — | — | — |
根因分析
python_requires 字段使用了不是有效 PEP 440 说明符的通配符模式;通配符仅允许作为 '==' 或 '!=' 前缀。
English
The python_requires field uses a wildcard pattern that is not a valid PEP 440 specifier; wildcards are only allowed as '==' or '!=' prefixes.
解决方案
-
98% 成功率
python_requires='>=3.7,<4'
-
95% 成功率
python_requires='>=3.7,!=3.7.0'
无效尝试
常见但无效的做法:
-
90% 失败
Quoting does not change PEP 440 validation; the specifier is still invalid.
-
50% 失败
Allows installation on unsupported interpreters, leading to runtime SyntaxErrors.
-
70% 失败
Older setuptools may accept it, but modern pip rejects the metadata during install.