错误:已忽略以下需要不同 Python 版本的版本:5.0.0 要求 Python >=3.11 错误:找不到满足 somepkg 要求的版本(可用版本:4.9.0, 4.9.1) 错误:未找到匹配的分发版本
ERROR: Ignored the following versions that require a different python version: 5.0.0 Requires-Python >=3.11 ERROR: Could not find a version that satisfies the requirement somepkg (from versions: 4.9.0, 4.9.1) ERROR: No matching distribution found for somepkg
ID: python/pip-requires-python-unsatisfied
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
根因分析
请求的包版本在其元数据中声明 Requires-Python >=3.11,但正在运行的解释器版本较旧(例如 3.9),因此 pip 将其过滤掉并报告未找到匹配的分发版本。
English
The requested package version declares Requires-Python >=3.11 in its metadata, but the running interpreter is older (e.g. 3.9), so pip filters it out and reports no matching distribution.
解决方案
-
95% 成功率
python --version pip install 'somepkg<5'
-
90% 成功率
# using pyenv pyenv install 3.11.9 pyenv local 3.11.9 python -m venv .venv && source .venv/bin/activate pip install somepkg
无效尝试
常见但无效的做法:
-
85% 失败
--pre only enables pre-release versions; the Requires-Python filter still applies.
-
95% 失败
pip has no --ignore-requires-python flag; the option is unrecognized and the command errors out.