# FileNotFoundError：[Errno 2] 没有那个文件或目录：'setup.py'
错误：在获取构建 wheel 所需依赖时构建 'foo' 失败

- **ID:** `python/setuptools-no-setup-py`
- **领域:** python
- **类别:** install_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

项目没有 setup.py（仅 pyproject.toml），但某个工具或 pip 调用假定使用旧的 setup.py 入口，或工作目录错误。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (92% 成功率)
   ```
   Add a minimal pyproject.toml with a build backend:
[build-system]
requires = ["setuptools>=61"]
build-backend = "setuptools.build_meta"

[project]
name = "foo"
version = "1.0.0"
   ```
2. **** (85% 成功率)
   ```
   Confirm you are in the project root:
ls pyproject.toml setup.py setup.cfg
pip install .
   ```

## 无效尝试

- **** — An empty setup.py makes the build fail later with 'no commands supplied' or metadata errors. (85% 失败率)
- **** — Still expects a build backend; if pyproject.toml is missing, there is nothing to build. (70% 失败率)
