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

其他格式: JSON · Markdown 中文 · English
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.

generic

解决方案

  1. 90% 成功率
    pip install https://files.pythonhosted.org/packages/.../somepkg-1.0.0-py3-none-any.whl
  2. 70% 成功率
    pip install --upgrade pip packaging
    pip install somepkg

无效尝试

常见但无效的做法:

  1. 90% 失败

    The malformed version is not a pre-release; parsing still fails before any filter applies.

  2. 75% 失败

    If the index metadata includes the malformed version, pip still parses all versions and errors.