python config_error ai_generated true

错误:找不到文件 "setup.py"。没有构建后端时无法执行可编辑安装。

ERROR: File "setup.py" not found. Cannot perform editable install without a build backend.

ID: python/pip-editable-install-missing-pyproject

其他格式: JSON · Markdown 中文 · English
80%修复率
87%置信度
0证据数
2025-08-05首次发现

版本兼容性

版本状态引入弃用备注
3.x active — — —

根因分析

pip install -e . 需要 setup.py 或 pyproject.toml 中的 [build-system] 表来定义支持可编辑安装的后端。

English

pip install -e . requires either setup.py or a [build-system] table in pyproject.toml to define an editable-capable backend.

generic

解决方案

  1. 95% 成功率
    Add a build-system table to pyproject.toml: [build-system]\nrequires = ["setuptools>=61", "wheel"]\nbuild-backend = "setuptools.build_meta"
  2. 90% 成功率
    Use a hatchling backend for pure-Python projects: [build-system]\nrequires = ["hatchling"]\nbuild-backend = "hatchling.build"
  3. 92% 成功率
    Migrate to a PEP 621 [project] table and re-run pip install -e .

无效尝试

常见但无效的做法:

  1. 85% 失败

    An empty setup.py declares no package metadata, so the editable install produces no importable package.

  2. 90% 失败

    Disabling isolation does not provide a build backend; the error persists.

  3. 70% 失败

    Installs a copy, so source edits are not reflected, defeating the purpose of -e.