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

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

## 根因

pip 是从不包含 requirements 文件的目录调用的，或文件名拼写错误（例如 requirements-dev.txt）。

## 版本兼容性

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

## 解决方案

1. **** (98% 成功率)
   ```
   pwd
ls requirements*.txt
pip install -r "$(pwd)/requirements.txt"
   ```
2. **** (90% 成功率)
   ```
   pip freeze > requirements.txt
pip install -r requirements.txt
   ```

## 无效尝试

- **** — The error is a missing file, not a pip bug; upgrading does not create the file. (95% 失败率)
- **** — --no-cache-dir affects the HTTP cache, not file lookup; the same FileNotFoundError occurs. (95% 失败率)
