# 错误：无法为 foo 构建 wheel，这是安装基于 pyproject.toml 的项目所必需的
  ModuleNotFoundError：没有名为 'setuptools' 的模块

- **ID:** `python/pip-build-backend-missing-setuptools-legacy`
- **领域:** python
- **类别:** install_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

包的隔离构建环境缺少 setuptools。当构建后端为 setuptools 但构建隔离无法获取它，或在 setuptools 被卸载的环境中运行时发生。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.8+ | active | — | — |

## 解决方案

1. **** (90% 成功率)
   ```
   python -m pip install --upgrade setuptools wheel
python -m pip install foo
   ```
2. **** (85% 成功率)
   ```
   python -m pip install --upgrade setuptools wheel
python -m pip install --no-build-isolation foo
   ```

## 无效尝试

- **** — Runs the build in the current env; if setuptools isn't installed there either, same error. Also risks version skew. (70% 失败率)
- **** — You cannot interact with pip's ephemeral isolated build env; it is torn down automatically. (90% 失败率)
