python
config_error
ai_generated
true
错误:无效的依赖项:'git+https://github.com/org/repo.git#egg=my-pkg&subdirectory=src'
ERROR: Invalid requirement: 'git+https://github.com/org/repo.git#egg=my-pkg&subdirectory=src'
ID: python/pip-egg-fragment-not-supported
80%修复率
86%置信度
0证据数
2025-01-08首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
根因分析
egg 片段包含多个用 '&' 连接参数;pip 的依赖解析器只接受 URL 片段中的单个 #egg=name 或 #subdirectory=。
English
The egg fragment contains multiple '&'-joined parameters; pip's requirement parser accepts only a single #egg=name or #subdirectory= in the URL fragment.
解决方案
-
95% 成功率
# requirements.txt git+https://github.com/org/[email protected]#subdirectory=src # or git+https://github.com/org/[email protected]#egg=my-pkg
-
85% 成功率
pip install 'git+https://github.com/org/[email protected]' --config-settings editable_mode=compat # or clone + install pip install ./repo/src
无效尝试
常见但无效的做法:
-
90% 失败
Quotes become part of the URL and are still parsed as an invalid requirement.
-
80% 失败
The parser still sees two fragment parameters after decoding and rejects the requirement.