python
data_error
ai_generated
partial
packaging.version.InvalidVersion:无效版本:'1.0.0.post'
packaging.version.InvalidVersion: Invalid version: '1.0.0.post'
ID: python/pip-version-parse-legacy-epoch
80%修复率
85%置信度
0证据数
2024-12-01首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
根因分析
某个包发布了违反 PEP 440 的版本字符串(例如末尾的 '.post' 没有数字),导致 packaging.version 在解析时抛出异常。
English
A package published a version string that violates PEP 440 (e.g. trailing '.post' without a number), causing packaging.version to raise during resolution.
解决方案
-
90% 成功率
pip install https://files.pythonhosted.org/packages/.../somepkg-1.0.0-py3-none-any.whl
-
70% 成功率
pip install --upgrade pip packaging pip install somepkg
无效尝试
常见但无效的做法:
-
90% 失败
The malformed version is not a pre-release; parsing still fails before any filter applies.
-
75% 失败
If the index metadata includes the malformed version, pip still parses all versions and errors.