安装Pillow及报错的3种解决方法

安装Pillow及报错的3种解决方法

大家好!我是老码农。

《码农说》公众号的第16篇文章来袭。

今天分享的主题:如何安装Pillow及报错的3种解决方法。

看到很多同学安装时Pillow会遇到些问题。

我做了一个梳理,希望对大家能有帮助。

官网

  • 官网-英文

  • https://pillow.readthedocs.io/en/latest/installation.html

  • 官网-中文

    • https://pillow-zh-cn.readthedocs.io/zh-cn/latest/index.html
  • GitHub

    • https://github.com/python-pillow/Pillow
  • 安装指引

    • https://pillow-zh-cn.readthedocs.io/zh-cn/latest/installation.html

    详细记述了安装的注意事项

  • 手册

    • https://pillow-zh-cn.readthedocs.io/zh-cn/latest/handbook/index.html

    详细介绍如何使用Pillow

安装

我使用的是conda包管理器进行的安装,还是比较顺利的,一次成功。

我之前在oldgeek环境里,安装过jupyterlabpandas等包,估计当时就把Pillow给安装上了。

(oldgeek) C:\oldgeek>conda install -y Pillow
Retrieving notices: ...working... done
Channels:
 - defaults
 - conda-forge
Platform: win-64
Collecting package metadata (repodata.json): done
Solving environment: done

# All requested packages already installed.


(oldgeek) C:\oldgeek>

如果遇到问题

第1种方案:尝试用conda安装
conda install -y Pillow
第2种方案

参照官网的安装指引,指引地址

  • https://pillow-zh-cn.readthedocs.io/zh-cn/latest/installation.html

官方指引上有明确记载,注意Python的版本和Pillow的版本

警告

Pillow 和 PIL 不能同时存在. 请务必在安装Pillow之前卸载PIL.

警告

Pillow >= 1.0 的版本不再支持 “import Image”. 请使用 “from PIL import Image” 来代替之.

警告

Pillow >= 2.1.0 的版本不再支持 “import _imaging”. 请使用 “from PIL.Image import core as _imaging” 来代替之.

注解

注解

Pillow < 2.0.0 支持这些 Python 版本: 2.4, 2.5, 2.6, 2.7.

注解

Pillow >= 2.0.0 支持这些 Python 版本: 2.6, 2.7, 3.2, 3.3, 3.4, 3.5

如果用pip安装的话,可以尝试

python3 -m pip install --upgrade pip
python3 -m pip install --upgrade Pillow

官方这里有详细的关于版本对照的记述

  • https://pillow.readthedocs.io/en/latest/installation.html
Python3.123.113.103.93.83.73.63.5
Pillow >= 10.1YesYesYesYesYes
Pillow 10.0YesYesYesYes
Pillow 9.3 - 9.5YesYesYesYesYes
Pillow 9.0 - 9.2YesYesYesYes
Pillow 8.3.2 - 8.4YesYesYesYesYes
Pillow 8.0 - 8.3.1YesYesYesYes
Pillow 7.0 - 7.2YesYesYesYes
第3种方式

大家可以参照下这篇文章的第二种方法, 下载指定版本的,然后安装

码农说

好的!今天就聊到这里!点个关注呗!创作不易,大家的支持就是我坚持下去的原动力!

这是咱们程序员的家,一起分享最好的工具、最优质的资源、最干的文章,闲来无事唠唠职场。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值