ERROR
pip
data_error
ai_generated
true
错误:由于 ZipError 无法安装包:[Errno 2] 没有那个文件或目录: '/path/to/package.whl'
ERROR: Could not install packages due to a ZipError: [Errno 2] No such file or directory: '/path/to/package.whl'
ID: pip/zip-deflate-error
85%修复率
82%置信度
1证据数
2023-09-20首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| pip 23.1 | active | — | — | — |
| pip 24.0 | active | — | — | — |
| Python 3.10 | active | — | — | — |
| Python 3.11 | active | — | — | — |
根因分析
pip 在安装过程中遇到损坏或不完整的 .whl 文件,通常由下载中断或文件系统问题(如磁盘满或坏扇区)引起。
English
pip encounters a corrupted or incomplete .whl file during installation, often caused by interrupted download or filesystem issues like a full disk or bad sectors.
官方文档
https://pip.pypa.io/en/stable/topics/local-project-installs/解决方案
-
Clear pip's cache and re-download: pip cache purge && pip install package --no-cache-dir
-
Manually delete the specific .whl file from pip's cache directory: rm -rf ~/.cache/pip/http/* && pip install package
-
If the disk is full, free up space: df -h . && rm -rf /tmp/pip-* && pip install package
无效尝试
常见但无效的做法:
-
70% 失败
Running pip install --no-cache-dir does not fix the corrupted .whl; it only bypasses the cache but the download may still be corrupt.
-
85% 失败
Using pip install --force-reinstall only re-downloads the same corrupted wheel if the source is bad.
-
95% 失败
Setting PIP_REQUIRE_VIRTUALENV does not address the file corruption; it's unrelated to disk or download issues.