# 错误：项目有 'pyproject.toml'，但其构建后端缺少 'build_editable' 钩子。无法构建可编辑版本。构建后端不支持 'build_editable' 钩子。

- **ID:** `pip/pep-660-editable-install-fails-no-build-backend`
- **领域:** pip
- **类别:** build_error
- **错误码:** `ERROR`
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

pyproject.toml 中指定的构建后端（例如较旧版本的 setuptools 或自定义后端）未实现 PEP 660 的 `build_editable` 钩子，而该钩子是使用 `pip install -e` 进行可编辑安装所必需的。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| pip 21.3 | active | — | — |
| pip 23.0 | active | — | — |
| pip 23.2.1 | active | — | — |

## 解决方案

1. ```
   升级构建后端到支持 PEP 660 的版本。对于 setuptools：`pip install --upgrade setuptools>=64.0.0`。对于 flit：`pip install --upgrade flit_core>=3.8.0`。然后重试 `pip install -e .`。
   ```
2. ```
   临时切换到非可编辑安装：使用 `pip install .` 代替 `pip install -e .`。这将绕过 `build_editable` 钩子的要求。
   ```

## 无效尝试

- **** — The `--no-build-isolation` flag does not add the missing `build_editable` hook; it only prevents pip from creating a temporary build environment. The backend still lacks the hook. (90% 失败率)
- **** — This config setting is for setuptools specifically and only works if the backend already supports editable installs; it does not add the missing hook. (85% 失败率)
