# 错误：无法为 foo 构建 wheel，这是安装基于 pyproject.toml 的项目所必需的

× 准备元数据（pyproject.toml）未能成功运行。
╰─> BackendUnavailable: 无法导入 'setuptools.build_meta'

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

## 根因

pyproject.toml [build-system].build-backend 中声明的构建后端无法在隔离的构建环境中导入，通常是因为后端包未列入 [build-system].requires。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   Add the backend to requires in pyproject.toml:
  [build-system]
  requires = ["setuptools>=61", "wheel"]
  build-backend = "setuptools.build_meta"
For hatchling: requires = ["hatchling"], build-backend = "hatchling.build"
   ```
2. **** (80% 成功率)
   ```
   If you only consume the package, install the backend manually then build without isolation:
  pip install setuptools wheel
  pip install --no-build-isolation foo
   ```

## 无效尝试

- **** — Without isolation, the backend must already be installed in your env; if it is not, the same error occurs. (70% 失败率)
- **** — pip version does not affect whether the build backend is importable. (90% 失败率)
