
本文详解为何在 python 3.5 中执行 `pip install pillow` 会静默中断,以及如何通过指定旧版 pillow(如 5.0.0)或升级环境来解决该问题。
在 Python 3.5 环境中尝试安装 Pillow 时,若执行 pip install pillow 或 pip install Pillow==6.2.1 后仅显示 Collecting pillow 随即返回命令行、无报错也无后续安装流程,这并非网络中断或权限问题,而是典型的版本不兼容导致的静默失败——pip 在解析依赖或匹配 wheel 包时因找不到适配 Python 3.5 的预编译二进制文件(wheel),自动回退至源码编译;而 Pillow 自 6.x 起已移除对 Python 3.5 的官方支持,且其构建依赖(如 setuptools, wheel, C compiler)在旧环境中常缺失或版本过低,最终导致 pip 无法继续并悄然退出。
✅ 正确解决方案如下:
方案一:安装 Pillow 兼容旧版本(推荐用于临时维持 Python 3.5)
Pillow 5.0.0 是最后一个明确支持 Python 3.5 的稳定版本(发布于 2018 年,兼容 3.4–3.7)。请确保 pip 已更新至较新版本(至少 9.0+),然后执行:
pip install "Pillow==5.0.0"
⚠️ 注意:务必使用双引号包裹版本号(尤其在 zsh/bash 中),避免 shell 将 == 误解析;若提示 Failed building wheel for Pillow,请先安装编译依赖:Ubuntu/Debian:sudo apt-get install libjpeg-dev libpng-dev libtiff-dev libharfbuzz-dev libfribidi-dev libwebp-devmacOS(Homebrew):brew install libjpeg libpng libtiff webp harfbuzz fribidi
方案二:升级 Python 和 pip(长期推荐)
Python 3.5 已于 2020 年 9 月终止官方支持(EOL),当前主流库(包括 Pillow ≥ 9.0.0、requests、numpy 等)普遍要求 Python ≥ 3.8。建议升级至 Python 3.9+ 并同步更新 pip:
# 升级 pip(在虚拟环境中执行) python -m pip install --upgrade pip # 安装最新 Pillow(自动匹配平台与 Python 版本) pip install Pillow
? 总结:静默中断的本质是 pip 在兼容性校验失败后放弃安装,而非“卡住”。排查此类问题可添加 -v(verbose)参数获取详细日志:
pip install -v Pillow==6.2.1
日志中若出现 Could not find a version that satisfies the requirement Pillow==6.2.1 或 Skipping link ... (not in wheel) because it is not compatible with this Python,即可确认为版本不匹配。优先选择方案一快速修复,但务必规划向 Python 3.8+ 迁移,以保障安全性、性能与生态兼容性。
立即学习“Python免费学习笔记(深入)”;










