python
config_error
ai_generated
true
错误:无效的命令类 'foo.bar' # 来自 [options.entry_points] 或未知的 setup.cfg 键
error: invalid command class 'foo.bar' # from [options.entry_points] or unknown setup.cfg key
ID: python/setuptools-setup-cfg-unknown-key
80%修复率
80%置信度
0证据数
2024-08-12首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.x | active | — | — | — |
根因分析
setup.cfg 的某个节或键拼写错误,或不被已安装的 setuptools 版本支持(如用旧版 setuptools 使用新版才有的键),因此 setuptools 将其视为无效命令。
English
A setup.cfg section or key is misspelled or unsupported by the installed setuptools version (e.g. a key from a newer setuptools used with an older one), so setuptools treats it as an invalid command.
解决方案
-
85% 成功率
Upgrade setuptools to one that supports the key: python -m pip install --upgrade setuptools # then rebuild
-
78% 成功率
Validate the config: python -c "import configparser; c=configparser.ConfigParser(); c.read('setup.cfg'); print(c.sections())" # compare keys against setuptools docs
无效尝试
常见但无效的做法:
-
60% 失败
Disabling isolation doesn't fix an unknown config key; the same invalid command error is raised by the local setuptools.
-
75% 失败
Removes all metadata and entry points, causing a different failure (missing name/version) instead of fixing the key.