# 错误：对于 '<package>' 的传统可编辑安装，未找到 'setup.cfg' 文件。可编辑安装需要 setup.cfg 或 pyproject.toml。

- **ID:** `pip/editable-install-no-setup-cfg`
- **领域:** pip
- **类别:** install_error
- **错误码:** `ERROR`
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

pip 的传统可编辑安装模式（使用 setup.py develop）需要包含元数据的 setup.cfg 文件，但项目目录中缺少该文件。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| pip 23.1 | active | — | — |
| pip 23.2 | active | — | — |
| pip 24.0 | active | — | — |
| setuptools 68.0 | active | — | — |

## 解决方案

1. ```
   Add a setup.cfg file with minimum metadata:
[metadata]
name = <package>
version = 0.1.0
[options]
packages = find:
   ```
2. ```
   Use modern editable install: pip install -e . --config-settings editable_mode=compat
   ```
3. ```
   Upgrade to pip 21.3+ and use pyproject.toml with setuptools backend:
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
   ```

## 无效尝试

- **** — Still uses legacy editable mode; missing setup.cfg causes the same error. (90% 失败率)
- **** — An empty setup.cfg lacks required metadata fields (name, version), causing a different error later. (80% 失败率)
- **** — This changes the source but still requires the target project to have proper structure; often fails with same error. (60% 失败率)
