# 错误：异常：回溯（最近一次调用最后）：... zipfile.BadZipFile: 文件不是 zip 文件

- **ID:** `python/pip-cache-corrupted-unexpected-eof`
- **领域:** python
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

pip 的 HTTP 缓存或 wheel 缓存中包含损坏的下载文件，通常是由于网络传输中断或磁盘写入错误导致。pip 尝试将缓存文件作为 zip 归档读取时失败。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.7 | active | — | — |
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   Clear pip's cache: pip cache purge, then retry the installation.
   ```
2. **** (90% 成功率)
   ```
   Bypass cache for a single install: pip install --no-cache-dir <package>.
   ```

## 无效尝试

- **** — Reinstalling pip does not clear the corrupted cache; the bad file remains and will be reused. (80% 失败率)
- **** — Force reinstall still reads from cache first; corrupted cache causes the same error. (75% 失败率)
