# ERROR: 包 'foo' 需要不同的 Python 版本：3.9.18 不在 '>=3.10' 范围内

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

## 根因

该包的 pyproject.toml 中声明的 requires-python 最低版本高于当前运行的 Python 解释器版本，因此 pip 拒绝安装。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   pyenv install 3.10.13 && pyenv local 3.10.13
python -m venv .venv && source .venv/bin/activate
pip install foo
   ```
2. **** (93% 成功率)
   ```
   Use uv or conda to create an env with the required Python:
uv venv --python 3.10 && uv pip install foo
   ```

## 无效尝试

- **** — Bypasses the check but the package often uses syntax/APIs unavailable on the older interpreter, causing runtime failures. (65% 失败率)
- **** — Older releases may have unrelated bugs or missing security patches, and the user still needs the new features. (55% 失败率)
