# 错误：安装脚本退出，错误：命令 'gcc' 失败：没有那个文件或目录

- **ID:** `python/setuptools-command-not-found-error`
- **领域:** python
- **类别:** system_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

具有 C 扩展的 Python 包需要 C 编译器（如 gcc），但系统上未安装。

## 版本兼容性

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

## 解决方案

1. **Install C compiler and Python development headers** (90% 成功率)
   ```
   On Ubuntu/Debian: `sudo apt-get install build-essential python3-dev`. On CentOS/RHEL: `sudo yum install gcc python3-devel`
   ```
2. **Use a pre-built wheel if available** (75% 成功率)
   ```
   `pip install --only-binary=:all: <package_name>` or find a wheel from PyPI or an alternative index.
   ```

## 无效尝试

- **Installing gcc but not the required development headers (python3-dev)** — Without Python headers, gcc cannot find necessary include files like Python.h (60% 失败率)
- **Using `pip install --no-build-isolation` alone** — This flag only disables build isolation, but gcc is still needed for compilation. (80% 失败率)
