python
config_error
ai_generated
true
错误:无法打开需求文件:[Errno 2] 没有那个文件或目录:'requirements/base.txt'
ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements/base.txt'
ID: python/pip-req-file-not-found-relative
80%修复率
87%置信度
0证据数
2024-11-19首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.x | active | — | — | — |
根因分析
-r 路径相对于当前工作目录解析,而不是相对于包含 -r 行的文件。
English
The -r path is resolved relative to the current working directory, not to the file that contains the -r line.
解决方案
-
98% 成功率
cd /path/to/project pip install -r requirements/base.txt
-
95% 成功率
# requirements.txt at project root -r requirements/base.txt -r requirements/dev.txt pip install -r requirements.txt
无效尝试
常见但无效的做法:
-
90% 失败
--no-index affects package lookup, not file resolution.
-
85% 失败
MANIFEST.in is for sdist contents, not for pip's requirements resolution.
-
60% 失败
Changes the base for resolution but may break other relative paths in the same file.