# 错误：无法解析：因为 package-a 依赖于 package-b，而 package-b 又依赖于 package-a

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

## 根因

两个或多个包存在循环依赖，pip 的解析器无法处理。

## 版本兼容性

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

## 解决方案

1. **Use a version of one package that breaks the cycle** (80% 成功率)
   ```
   Check if older versions avoid the circular dependency: `pip install package-a==1.0 package-b==2.0`
   ```
2. **Install packages in a specific order using --no-deps and then manually install dependencies** (70% 成功率)
   ```
   `pip install --no-deps package-a && pip install package-b && pip install package-a` (if circular is partial)
   ```

## 无效尝试

- **Installing one package with --no-deps** — This breaks the dependency chain, but the package may fail at runtime without its dependency. (70% 失败率)
- **Using --force-reinstall** — Reinstallation does not resolve the circular dependency; it just reinstalls the same conflicting versions. (90% 失败率)
