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
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.
解决方案
-
97% 成功率
pip cache purge pip install --no-cache-dir -r requirements.txt
-
95% 成功率
rm -rf ~/.cache/pip/wheels pip install -r requirements.txt
无效尝试
常见但无效的做法:
-
80% 失败
Force reinstall still consults the cache and reuses the corrupted wheel.
-
90% 失败
Does not bypass hash verification or cache lookup.
-
95% 失败
Only affects TLS trust, not wheel hash verification.