python
config_error
ai_generated
true
错误:在平面布局中发现多个顶级包:['package1', 'package2']。
error: Multiple top-level packages discovered in a flat-layout: ['package1', 'package2'].
ID: python/setuptools-long-description-error
80%修复率
85%置信度
0证据数
2025-05-22首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
根因分析
setuptools 自动发现包,但在同一目录中找到多个,导致歧义。
English
setuptools automatically discovers packages but finds multiple in the same directory, causing ambiguity.
解决方案
-
90% 成功率 Explicitly specify packages in setup.py or setup.cfg
In setup.cfg, add '[options]\npackages = find:' and configure find options, or list packages manually.
-
85% 成功率 Use a src-layout
Move packages into a 'src/' directory and set 'package_dir = {"": "src"}' in setup.cfg.
无效尝试
常见但无效的做法:
-
Ignoring the warning and proceeding
80% 失败
setuptools may fail to build or include wrong packages.
-
Renaming the packages to have a common prefix
60% 失败
This does not resolve the flat-layout detection logic.