python install_error ai_generated true

错误:无效要求:'foo==1.0.0' 提示:看起来像路径。文件 'foo==1.0.0' 不存在。

ERROR: Invalid requirement: 'foo==1.0.0' Hint: It looks like a path. File 'foo==1.0.0' does not exist.

ID: python/pip-invalid-requirement-no-matching-distribution

其他格式: JSON · Markdown 中文 · English
80%修复率
85%置信度
0证据数
2024-05-20首次发现

版本兼容性

版本状态引入弃用备注
3.9 active — — —
3.10 active — — —
3.11 active — — —
3.12 active — — —

根因分析

由于引号或 shell 展开问题,pip 将参数解析为本地路径,或者要求字符串包含无效字符。

English

pip parsed the argument as a local path because of quoting or shell expansion issues, or the requirement string contains invalid characters.

generic

解决方案

  1. 92% 成功率
    Quote the requirement: `pip install 'foo==1.0.0'` (single quotes on Unix).
  2. 80% 成功率
    Check for stray spaces or shell globbing; use `--` separator: `pip install -- foo==1.0.0`.

无效尝试

常见但无效的做法:

  1. 90% 失败

    The user intended to install a package, not reference a file.

  2. 80% 失败

    Does not fix parsing of the requirement.