# SetuptoolsDeprecationWarning：setup.py install 已弃用，请使用 build 和 pip 等基于标准的工具。SetuptoolsDeprecationWarning：namespace_packages 参数已弃用。

- **ID:** `python/setuptools-find-namespace-packages-deprecated`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

项目仍使用已弃用的 setup.py install 路径和 namespace_packages 关键字，setuptools 已弃用它们，推荐使用 PEP 420 原生命名空间包和基于 pyproject.toml 的构建。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## 解决方案

1. **** (85% 成功率)
   ```
   # remove namespace_packages from setup.cfg/setup.py
# rely on implicit namespace packages:
# mypkg/sub/__init__.py (implicit, no __init__ needed at mypkg level)
pip install -e .
   ```
2. **** (90% 成功率)
   ```
   python -m pip install build
python -m build
pip install dist/*.whl
   ```

## 无效尝试

- **** — Suppresses warnings but the deprecated code path still runs and will be removed in future setuptools releases. (70% 失败率)
- **** — Avoids the warning but blocks security fixes and breaks on Python 3.12+ where distutils is gone. (80% 失败率)
