# 错误：传统安装失败
× 尝试安装包时遇到错误。
╰> numpy

注意：这是上述包的问题，不是 pip 的问题。
提示：查看 'pip debug --verbose' 的输出以了解当前兼容性概览。

- **ID:** `pip/legacy-setup-py-install-error`
- **领域:** pip
- **类别:** build_error
- **错误码:** `error`
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

Pip 的传统 setup.py 安装路径失败，因为包（例如 numpy）使用了与当前 pip 或 Python 版本不兼容的过时构建系统，通常是由于缺少编译器工具链或不支持的构建标志。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| pip 21.3+ | active | — | — |
| numpy <1.20 | active | — | — |
| Python 3.10 | active | — | — |

## 解决方案

1. ```
   将包升级到支持现代构建后端的版本：pip install numpy>=1.20
   ```
2. ```
   如果可用，使用预构建的 wheel：pip install --only-binary=:all: numpy
   ```
3. ```
   安装仍支持传统 setup.py 的兼容 Python 版本（例如 Python 3.8）并使用 pip<21.0
   ```

## 无效尝试

- **Reinstalling pip with --upgrade pip** — Upgrading pip alone does not fix the underlying build system incompatibility; the issue is with the package's setup.py, not pip itself. (20% 失败率)
- **Manually running python setup.py install in the package directory** — This bypasses pip but still uses the same broken build system, leading to the same error or different cryptic failures. (50% 失败率)
- **Installing with --no-build-isolation flag** — This may expose missing system dependencies but does not fix the core setup.py issue; often results in different build errors. (40% 失败率)
