# 错误：包目录'src/mypackage'不存在

- **ID:** `python/setuptools-package-dir-not-found`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

在'packages'或'package_dir'中指定的目录在磁盘上不存在。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.8 | active | — | — |

## 解决方案

1. **Create the missing directory with __init__.py** (95% 成功率)
   ```
   mkdir -p src/mypackage
touch src/mypackage/__init__.py
   ```
2. **Update setup.py to match existing structure** (90% 成功率)
   ```
   from setuptools import find_packages
setup(
    packages=find_packages(where='src'),
    package_dir={'': 'src'}
)
   ```

## 无效尝试

- **Creating a placeholder __init__.py in wrong location** — The directory structure must match exactly; wrong location doesn't fix. (80% 失败率)
- **Removing package_dir entirely** — Breaks package discovery; setuptools may look in wrong place. (60% 失败率)
