# 错误：无法安装 <package-a> 和 <package-b>，因为这些包的版本存在冲突的依赖关系。冲突由以下原因引起：<package-c> 1.0 依赖于 <package-d>!=2.0，而 <package-e> 2.0 依赖于 <package-d>==2.0。

- **ID:** `pip/dependency-conflict-with-extras-and-markers`
- **领域:** pip
- **类别:** config_error
- **错误码:** `ERROR`
- **验证级别:** ai_generated
- **修复率:** 82%

## 根因

依赖树中的两个或多个包要求共享依赖的互斥版本，创建了 pip 解析器无法解决的不可满足的约束。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| pip 22.0 | active | — | — |
| pip 23.1.2 | active | — | — |
| pip 24.0 | active | — | — |

## 解决方案

1. ```
   使用虚拟环境并显式安装兼容版本。示例：`pip install <package-c>==1.0 <package-e>==1.5`，其中版本已知兼容。测试后在 requirements.txt 文件中固定所有依赖项。
   ```
2. ```
   使用 `pip install <package-a> <package-b> --upgrade --upgrade-strategy eager` 强制 pip 将所有依赖项升级到最新的兼容版本，这可能会解决冲突。
   ```

## 无效尝试

- **** — This flag skips dependency resolution entirely, but the installed packages may be broken at runtime due to missing or conflicting dependencies. (75% 失败率)
- **** — The `--no-deps` flag only prevents installation of dependencies for that specific package, but the conflict may still exist in the shared dependency tree; runtime errors are likely. (80% 失败率)
