python install_error ai_generated true

错误:这些包与需求文件中的哈希值不匹配。 期望 sha256 abc... 实际 def... /root/.cache/pip/wheels/.../mypkg-1.0-py3-none-any.whl

ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. Expected sha256 abc... Got def... /root/.cache/pip/wheels/.../mypkg-1.0-py3-none-any.whl

ID: python/pip-cache-corrupt-wheel-hash

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

版本兼容性

版本状态引入弃用备注
3.x active

根因分析

~/.cache/pip 中的缓存 wheel 已损坏或由不同源码构建,因此其哈希不再与固定值匹配。

English

A cached wheel in ~/.cache/pip is corrupted or was built from different sources, so its hash no longer matches the pinned value.

generic

解决方案

  1. 97% 成功率
    pip cache purge
    pip install --no-cache-dir -r requirements.txt
  2. 95% 成功率
    rm -rf ~/.cache/pip/wheels
    pip install -r requirements.txt

无效尝试

常见但无效的做法:

  1. 80% 失败

    Force reinstall still consults the cache and reuses the corrupted wheel.

  2. 90% 失败

    Does not bypass hash verification or cache lookup.

  3. 95% 失败

    Only affects TLS trust, not wheel hash verification.