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

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

generic

解决方案

  1. 98% 成功率
    python_requires='>=3.7,<4'
  2. 95% 成功率
    python_requires='>=3.7,!=3.7.0'

无效尝试

常见但无效的做法:

  1. 90% 失败

    Quoting does not change PEP 440 validation; the specifier is still invalid.

  2. 50% 失败

    Allows installation on unsupported interpreters, leading to runtime SyntaxErrors.

  3. 70% 失败

    Older setuptools may accept it, but modern pip rejects the metadata during install.