# 错误：无法打开 requirements 文件：[Errno 2] 没有那个文件或目录：'requirements.txt'

- **ID:** `python/pip-requirements-file-not-found`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

指定的 requirements 文件在当前工作目录中不存在。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## 解决方案

1. **Check the current directory and create the file if needed** (95% 成功率)
   ```
   ls && echo 'mypackage' > requirements.txt && pip install -r requirements.txt
   ```
2. **Specify the full path to the requirements file** (90% 成功率)
   ```
   pip install -r /path/to/requirements.txt
   ```

## 无效尝试

- **Creating an empty requirements.txt file** — An empty file will install nothing, but the error is about a missing file. (80% 失败率)
- **Using a different file name like require.txt** — pip expects the exact filename; it won't auto-detect. (90% 失败率)
