python install_error ai_generated true

错误:这些包与需求文件中的哈希不匹配。如果您已更新包版本,请更新哈希值。

ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes.

ID: python/pip-invalid-requirement-hash-mismatch

其他格式: JSON · Markdown 中文 · English
80%修复率
90%置信度
0证据数
2024-05-09首次发现

版本兼容性

版本状态引入弃用备注
3.8 active — — —
3.9 active — — —
3.10 active — — —
3.11 active — — —
3.12 active — — —

根因分析

下载的 wheel/sdist 的 SHA256 与 requirements.txt 中固定的哈希不匹配,可能是因为文件被重新上传、镜像提供不同的构建,或哈希行已过期。

English

The downloaded wheel/sdist SHA256 does not match the hash pinned in requirements.txt, either because the file was re-uploaded, the mirror serves a different build, or the hash line is stale.

generic

解决方案

  1. 95% 成功率
    Regenerate the hashes with pip-tools:
      pip install pip-tools
      pip-compile --generate-hashes requirements.in
    Then install:
      pip install -r requirements.txt
  2. 90% 成功率
    If you intentionally want to skip hashes temporarily, remove the --hash lines or the --require-hashes flag from the install command.

无效尝试

常见但无效的做法:

  1. 90% 失败

    --no-deps skips dependency resolution, not hash verification; the check still runs.

  2. 95% 失败

    --trusted-host only disables TLS verification, not hash verification.