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

× 获取构建 wheel 所需的要求未成功运行。
╰─> 后端不可用：无法导入 'setuptools.build_meta'

- **ID:** `python/pyproject-toml-missing-build-backend`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

声明的 PEP 517 构建后端无法在隔离构建环境中导入，通常因为缺少 setuptools，或 pyproject.toml 指定的后端未列入 `[build-system] requires`。

## 版本兼容性

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

## 解决方案

1. **** (90% 成功率)
   ```
   Fix pyproject.toml so `[build-system] requires = ["setuptools>=61", "wheel"]` and `build-backend = "setuptools.build_meta"`, then rebuild.
   ```
2. **** (75% 成功率)
   ```
   Bypass isolation for a quick local build: `pip install --no-build-isolation .` after installing setuptools/wheel in the current env.
   ```

## 无效尝试

- **** — Unrelated to the backend import failure. (92% 失败率)
- **** — Build isolation ignores the outer env's site-packages by design. (80% 失败率)
