python mac 安装pillow_在MacOS系统上安装Python的Pillow库的教程

本文介绍了在MacOS系统上安装Python的Pillow库时遇到的JPEG支持不可用问题,通过卸载Pillow,安装libjpeg,然后重新编译Pillow,最终成功解决并通过selftest.py验证。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

--------------------------------------------------------------------

version Pillow 2.4.0

platform darwin 2.7.5 (default, Aug 25 2013, 00:04:04)

[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]

--------------------------------------------------------------------

--- TKINTER support available

*** JPEG support not available

*** OPENJPEG (JPEG2000) support not available

--- ZLIB (PNG/ZIP) support available

*** LIBTIFF support not available

--- FREETYPE2 support available

*** LITTLECMS2 support not available

*** WEBP support not available

*** WEBPMUX support not available

--------------------------------------------------------------------

To add a missing option, make sure you have the required

library, and set the corresponding ROOT variable in the

setup.py script.

To check the build, run the selftest.py script.

4.2 因为JPEG support not available,运行python selftest.py报告错误

1 tests of 57 failed.

于是只好卸载pillow

可以通过pip命令来卸载

pip uninstall pillow

sudo pip uninstall pillow

Password:

Uninstalling Pillow:

/Library/Python/2.7/site-packages/Pillow-2.4.0-py2.7-macosx-10.9-intel.egg

/usr/local/bin/pilconvert.py

/usr/local/bin/pildriver.py

/usr/local/bin/pilfile.py

/usr/local/bin/pilfont.py

/usr/local/bin/pilprint.py

Proceed (y/n)? y

Successfully uninstalled Pillow

成功之后需要安装libjpeg的支持

brew install libjpeg

安装成功之后重新编译pillow

--------------------------------------------------------------------

version Pillow 2.4.0

platform darwin 2.7.5 (default, Aug 25 2013, 00:04:04)

[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]

--------------------------------------------------------------------

--- TKINTER support available

--- JPEG support available

*** OPENJPEG (JPEG2000) support not available

--- ZLIB (PNG/ZIP) support available

*** LIBTIFF support not available

--- FREETYPE2 support available

*** LITTLECMS2 support not available

*** WEBP support not available

*** WEBPMUX support not available

--------------------------------------------------------------------

python selftest.py

--------------------------------------------------------------------

Pillow 2.4.0 TEST SUMMARY

--------------------------------------------------------------------

Python modules loaded from /Users/macbook/yyang/app-devel-source/python/Pillow/PIL

Binary modules loaded from /Users/macbook/yyang/app-devel-source/python/Pillow/PIL

--------------------------------------------------------------------

--- PIL CORE support ok

--- TKINTER support ok

--- JPEG support ok

*** JPEG 2000 support not installed

--- ZLIB (PNG/ZIP) support ok

*** LIBTIFF support not installed

--- FREETYPE2 support ok

*** LITTLECMS2 support not installed

*** WEBP support not installed

--------------------------------------------------------------------

Running selftest:

--- 57 tests passed.

最后执行安装

sudo python setup.py install

本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉

本文系统来源:php中文网

本站所有资源全部来源于网络,若本站发布的内容侵害到您的隐私或者利益,请联系我们删除!

合作方式

Copyright © 2004-2018 https://www.gxlcms.com/. All Rights Reserved.

豫ICP备19030742号

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值