# 错误：无法安装 package-a 1.0 和 package-b 2.0，因为这些包版本有冲突的依赖。冲突由以下原因引起：package-a 1.0 依赖于 package-c>=3.0; python_version < '3.9'，而 package-b 2.0 依赖于 package-c<3.0; python_version >= '3.9'

- **ID:** `pip/dependency-conflict-with-marker`
- **领域:** pip
- **类别:** install_error
- **错误码:** `ERROR`
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

pip 的解析器检测到两个包之间由于环境标记（如 python_version）导致的依赖冲突，这些标记对共享依赖形成了互斥的版本要求，使得在当前 Python 版本下无法解析。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| pip 23.3 | active | — | — |
| pip 24.0 | active | — | — |
| pip 24.1 | active | — | — |

## 解决方案

1. ```
   Install a version of package-a or package-b that does not trigger the marker conflict: pip install 'package-a<1.0' 'package-b==2.0' (adjust versions based on resolver output).
   ```
2. ```
   Use a different Python version that satisfies one of the marker conditions: pyenv install 3.8 && pyenv local 3.8 && pip install package-a package-b
   ```
3. ```
   Pin package-c to a version that satisfies both markers (if possible): pip install 'package-c>=3.0,<3.0' (note: this may not exist; otherwise use a range that works for both).
   ```

## 无效尝试

- **** — Using pip install --upgrade --force-reinstall does not resolve the logical conflict; it only reinstalls packages without changing version constraints. (95% 失败率)
- **** — Setting PIP_REQUIRE_VIRTUALENV has no effect on dependency resolution logic. (98% 失败率)
- **** — Running pip install --no-deps package-a package-b installs both without dependencies but leaves them broken at runtime due to missing or wrong versions of package-c. (85% 失败率)
