python install_error ai_generated true

错误:无法检测 'git+https://github.com/org/repo.git@main' 的需求名称,请使用 #egg=your_package_name 指定一个。

ERROR: Could not detect requirement name for 'git+https://github.com/org/repo.git@main', please specify one with #egg=your_package_name

ID: python/pip-git-url-without-egg-fragment

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

版本兼容性

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

根因分析

pip 无法从没有旧式 `#egg=` 片段或 PEP 508 名称前缀的原始 VCS URL 推断出分发包名称。

English

pip cannot infer the distribution name from a raw VCS URL without the legacy `#egg=` fragment or a PEP 508 name prefix.

generic

解决方案

  1. 95% 成功率
    pip install 'your-package @ git+https://github.com/org/repo.git@main'
  2. 90% 成功率
    pip install 'git+https://github.com/org/repo.git@main#egg=your-package'

无效尝试

常见但无效的做法:

  1. 95% 失败

    Trusted-host is unrelated to name detection.

  2. 90% 失败

    pip still needs a name to record in metadata.

  3. 40% 失败

    Works but loses VCS provenance and complicates updates; not a general fix for requirements files.