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

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

## 根因

setuptools 找不到 setup.py 中 packages 或 package_dir 参数指定的包目录。这发生在目录名拼写错误或包结构不正确时。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   Verify the package directory exists and matches the name in setup.py. Use find_packages() to automatically discover packages.
   ```
2. **** (90% 成功率)
   ```
   If using src layout, specify package_dir={'': 'src'} and ensure the directory structure is correct.
   ```

## 无效尝试

- **** — The package won't contain the intended modules, leading to import errors at runtime. (80% 失败率)
- **** — setuptools may not include any packages, resulting in an empty distribution. (75% 失败率)
