# 错误：无效的需求：'requirements.txt'（来自 requirements.txt 第 1 行）
提示：看起来像路径。文件 'requirements.txt' 不存在。

- **ID:** `python/pip-invalid-requirement-no-such-file`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

需求文件包含一行看起来像路径，但文件不存在，或者遗漏了 -r/-c，导致 pip 将文件名当作包名处理。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   Use -r for nested requirements files:
  -r base.txt
  -r dev.txt
And check paths are relative to the including file, not the CWD.
   ```
2. **** (90% 成功率)
   ```
   Verify each referenced file exists:
  while read -r line; do [[ $line == -r* ]] && f=${line#-r } && [ -f "$f" ] || echo "missing: $f"; done < requirements.txt
   ```

## 无效尝试

- **** — Upgrade does not change how pip parses the line; the missing file still fails. (95% 失败率)
- **** — If the path is relative and the CWD is different, renaming does not help; the resolution context is the issue. (70% 失败率)
