python
config_error
ai_generated
true
错误:包目录 'mypackage' 不存在
error: package directory 'mypackage' does not exist
ID: python/setuptools-package-discovery-failed
80%修复率
87%置信度
0证据数
2025-08-15首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.7 | active | — | — | — |
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
根因分析
setuptools 找不到 setup.py 中 packages 或 package_dir 参数指定的包目录。这发生在目录名拼写错误或包结构不正确时。
English
setuptools cannot find the package directory specified in setup.py's packages or package_dir argument. This happens when the directory name is misspelled or the package structure is incorrect.
解决方案
-
95% 成功率
Verify the package directory exists and matches the name in setup.py. Use find_packages() to automatically discover packages.
-
90% 成功率
If using src layout, specify package_dir={'': 'src'} and ensure the directory structure is correct.
无效尝试
常见但无效的做法:
-
80% 失败
The package won't contain the intended modules, leading to import errors at runtime.
-
75% 失败
setuptools may not include any packages, resulting in an empty distribution.