# 错误：子进程退出并报错
× python setup.py egg_info 未能成功运行。
│ 退出码：1

- **ID:** `python/pip-install-error-subprocess-exited-with-error`
- **领域:** python
- **类别:** install_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

pip 尝试通过旧的 setup.py egg_info 路径从源码构建包，构建脚本失败——通常是缺少系统构建依赖（编译器、头文件）、setup.py 损坏，或 setuptools 版本不兼容。

## 版本兼容性

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

## 解决方案

1. **** (82% 成功率)
   ```
   pip install --only-binary=:all: <package>
# or force a wheel for a specific platform
pip install <package> --only-binary=:all: --platform manylinux2014_x86_64 --python-version 311 --implementation cp --abi cp311
   ```
2. **** (78% 成功率)
   ```
   # Debian/Ubuntu
sudo apt-get install -y build-essential python3-dev libffi-dev
# macOS
xcode-select --install
# then
pip install --no-build-isolation <package>
   ```
3. **** (90% 成功率)
   ```
   pip install -v <package> 2>&1 | tee pip.log
grep -A40 'error:' pip.log
   ```

## 无效尝试

- **** — Cache is not the cause; the build subprocess still fails identically because the underlying compiler/header issue remains. (85% 失败率)
- **** — Upgrading build tools helps only if the failure is due to outdated setuptools; missing C headers or a broken setup.py still fails. (60% 失败率)
