# 错误：无法同时安装 foo==1.2.3 和 bar==4.5.6，因为这些包版本存在依赖冲突。

- **ID:** `python/pip-no-matching-distribution-with-constraints`
- **领域:** python
- **类别:** install_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

新版 pip 解析器找不到一组传递依赖版本能同时满足所有声明的版本约束。

## 版本兼容性

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

## 解决方案

1. **** (90% 成功率)
   ```
   Install pip-tools and let it compute a consistent set: `pip install pip-tools && pip-compile requirements.in` then `pip-sync`.
   ```
2. **** (88% 成功率)
   ```
   Ask pip to explain: `pip install foo==1.2.3 bar==4.5.6 -v` and read the 'The conflict is caused by:' block, then relax one upper bound.
   ```

## 无效尝试

- **** — Installs incompatible transitive deps that will fail at import/runtime with confusing errors. (80% 失败率)
- **** — Whack-a-mole; each new pin surfaces the next conflict and the final set is often still inconsistent. (72% 失败率)
- **** — Legacy resolver silently picks the first candidate, hiding the conflict and shipping a broken environment. (85% 失败率)
