# 警告：缓存条目反序列化失败，已忽略该条目
错误：这些包与需求文件中的哈希不匹配。

- **ID:** `python/pip-cache-http-error-304-loop`
- **领域:** python
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

pip 的 HTTP 缓存持有一个损坏或过期的构件，其哈希不再匹配 requirements 中固定的 --hash。常见于下载中断或索引变更后。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.8+ | active | — | — |

## 解决方案

1. **** (92% 成功率)
   ```
   pip cache purge
pip install --no-cache-dir -r requirements.txt
   ```
2. **** (85% 成功率)
   ```
   pip download --no-deps --require-hashes -r requirements.txt -d /tmp/dl
pip hash /tmp/dl/foo-1.2.3-py3-none-any.whl  # update requirements
   ```

## 无效尝试

- **** — Disables supply-chain integrity checking entirely, defeating the purpose and exposing you to tampered packages. (85% 失败率)
- **** — You no longer know the artifact is authentic; you've just accepted whatever was downloaded. (90% 失败率)
