# 错误：找不到 'setup.cfg' 文件，无法进行 '<包名>' 的旧式可编辑安装

- **ID:** `pip/error-installing-packages-in-editable-mode-with-pyproject-toml-and-no-setup-cfg`
- **领域:** pip
- **类别:** build_error
- **错误码:** `ERROR`
- **验证级别:** ai_generated
- **修复率:** 85%

## 根因

Pip 正在尝试对一个具有 pyproject.toml 但没有 setup.cfg 的项目进行旧式可编辑安装 (pip install -e .)，而构建后端不支持 PEP 660 可编辑安装。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| pip 21.3-23.2 | active | — | — |
| Python 3.8-3.12 | active | — | — |
| setuptools 64+ | active | — | — |
| flit-core 3.8+ | active | — | — |

## 解决方案

1. ```
   pip install -e . --no-build-isolation
   ```
2. ```
   pip install --editable . --config-settings editable_mode=strict
   ```
3. ```
   pip install -e . --no-use-pep517 && pip install --no-deps --force-reinstall --no-build-isolation -e .
   ```

## 无效尝试

- **Creating an empty setup.cfg file in the project root** — Pip requires a properly formatted setup.cfg with package metadata; an empty file does not satisfy the legacy editable install mechanism. (95% 失败率)
- **Downgrading pip to version 21.2 or earlier** — Older pip versions may not support pyproject.toml-based builds properly, leading to other errors. (80% 失败率)
- **Using --no-use-pep517 flag** — This flag forces legacy setup.py install, which still requires setup.cfg for editable mode. (90% 失败率)
