# SetuptoolsDeprecationWarning：setup.py install 已弃用。请使用 build 和 pip 及其他基于标准的工具。

- **ID:** `python/setup-py-deprecated-invoke-setup`
- **领域:** python
- **类别:** install_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

运行 `python setup.py install`（或 `python setup.py develop`）会调用 setuptools 已弃用的旧代码路径，官方推荐使用 PEP 517/518 构建前端（如 pip）。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   Use pip: pip install . (pip invokes the PEP 517 build backend automatically)
   ```
2. **** (93% 成功率)
   ```
   Build a wheel first: python -m build && pip install dist/*.whl
   ```
3. **** (94% 成功率)
   ```
   For editable installs: pip install -e .
   ```

## 无效尝试

- **** — Suppresses the message but leaves the deprecated install path; future setuptools versions will remove it and break the build. (70% 失败率)
- **** — Pinning to an old setuptools breaks compatibility with modern pyproject.toml-based projects and other dependencies. (75% 失败率)
- **** — The --user flag does not change the deprecated code path; the warning persists and the install may still fail on modern Python. (80% 失败率)
