python
data_error
ai_generated
true
错误:异常:回溯(最近一次调用最后):... zipfile.BadZipFile: 文件不是 zip 文件
ERROR: Exception: Traceback (most recent call last): ... zipfile.BadZipFile: File is not a zip file
ID: python/pip-cache-corrupted-unexpected-eof
80%修复率
87%置信度
0证据数
2024-02-20首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.7 | active | — | — | — |
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
根因分析
pip 的 HTTP 缓存或 wheel 缓存中包含损坏的下载文件,通常是由于网络传输中断或磁盘写入错误导致。pip 尝试将缓存文件作为 zip 归档读取时失败。
English
pip's HTTP cache or wheel cache contains a corrupted download, often due to interrupted network transfer or disk write errors. pip attempts to read the cached file as a zip archive but fails.
解决方案
-
95% 成功率
Clear pip's cache: pip cache purge, then retry the installation.
-
90% 成功率
Bypass cache for a single install: pip install --no-cache-dir <package>.
无效尝试
常见但无效的做法:
-
80% 失败
Reinstalling pip does not clear the corrupted cache; the bad file remains and will be reused.
-
75% 失败
Force reinstall still reads from cache first; corrupted cache causes the same error.