# 错误：pip的依赖解析器当前未考虑所有已安装的包。此行为是以下依赖冲突的来源。<package>已安装但缺少<dependency>。

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

## 根因

pip的解析器在解析依赖时未检查所有已安装的包，导致当某个包需要未安装或不兼容版本的依赖时产生冲突。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| pip 21.3 | active | — | — |
| pip 22.0 | active | — | — |
| pip 23.0 | active | — | — |

## 解决方案

1. ```
   创建新的虚拟环境并使用固定版本安装包：`python -m venv venv && source venv/bin/activate && pip install -r requirements.txt`
   ```
2. ```
   使用 `pip check` 识别并手动修复缺失或冲突的依赖，然后安装缺失包：`pip install <missing-dependency>==<compatible-version>`
   ```

## 无效尝试

- **** — The resolver behavior is inherent to pip's design and not fixed by version upgrades alone. (60% 失败率)
- **** — This can break environment consistency and may reintroduce the same conflicts if requirements are not pinned. (50% 失败率)
