# 错误：pip 的依赖解析器目前未考虑所有已安装的包。此行为是以下依赖冲突的根源。
mypackage 1.0 需要 otherpackage<2.0，但您有 otherpackage 2.1，这不兼容。

- **ID:** `python/pip-dependency-conflict`
- **领域:** python
- **类别:** install_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

已安装的包存在冲突的版本要求，pip 无法自动解决。

## 版本兼容性

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

## 解决方案

1. **Create a new virtual environment and install compatible versions** (90% 成功率)
   ```
   python -m venv fresh_env && source fresh_env/bin/activate && pip install mypackage==1.0 otherpackage==1.9
   ```
2. **Use pip-tools to resolve dependencies** (85% 成功率)
   ```
   pip install pip-tools && pip-compile requirements.in && pip-sync requirements.txt
   ```

## 无效尝试

- **Running pip install --upgrade mypackage** — Upgrading mypackage may still require the conflicting version of otherpackage. (75% 失败率)
- **Ignoring the warning and continuing** — The conflict may cause runtime import errors or unexpected behavior. (60% 失败率)
