# 错误：无效的依赖项：'git+https://github.com/org/repo.git#egg=my-pkg&subdirectory=src'

- **ID:** `python/pip-egg-fragment-not-supported`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

egg 片段包含多个用 '&' 连接参数；pip 的依赖解析器只接受 URL 片段中的单个 #egg=name 或 #subdirectory=。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   # requirements.txt
git+https://github.com/org/repo.git@v1.2.3#subdirectory=src
# or
git+https://github.com/org/repo.git@v1.2.3#egg=my-pkg
   ```
2. **** (85% 成功率)
   ```
   pip install 'git+https://github.com/org/repo.git@v1.2.3' --config-settings editable_mode=compat
# or clone + install
pip install ./repo/src
   ```

## 无效尝试

- **** — Quotes become part of the URL and are still parsed as an invalid requirement. (90% 失败率)
- **** — The parser still sees two fragment parameters after decoding and rejects the requirement. (80% 失败率)
