python
config_error
ai_generated
true
错误:包目录'src/mypackage'不存在
error: package directory 'src/mypackage' does not exist
ID: python/setuptools-package-dir-not-found
80%修复率
85%置信度
0证据数
2024-05-12首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
根因分析
在'packages'或'package_dir'中指定的目录在磁盘上不存在。
English
The directory specified in 'packages' or 'package_dir' does not exist on disk.
解决方案
-
95% 成功率 Create the missing directory with __init__.py
mkdir -p src/mypackage touch src/mypackage/__init__.py
-
90% 成功率 Update setup.py to match existing structure
from setuptools import find_packages setup( packages=find_packages(where='src'), package_dir={'': 'src'} )
无效尝试
常见但无效的做法:
-
Creating a placeholder __init__.py in wrong location
80% 失败
The directory structure must match exactly; wrong location doesn't fix.
-
Removing package_dir entirely
60% 失败
Breaks package discovery; setuptools may look in wrong place.