MAC上安装 PIL库的问题,有同学知道吗?

2011-04-24 18:45:11 +08:00
 killall
系统版本:os x 10.6.7
python:2.6
安装的PIL库版本:PIL 1.1.7
libjpeg: v8c

在python setup.py build 的时候系统已经提示:

--- TKINTER support available
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
--- FREETYPE2 support available
--- LITTLECMS support available
安装完成后在web.py中使用的时候系统提示:
The _imaging C module is not installed

然后我进入控制台

python -v
import Image
import _imaging

系统返回错误信息:
import _imaging
dlopen("/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL-1.1.7-py2.6-macosx-10.3-fat.egg/_imaging.so", 2);
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL-1.1.7-py2.6-macosx-10.3-fat.egg/_imaging.so, 2): Symbol not found: _jpeg_resync_to_restart
Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL-1.1.7-py2.6-macosx-10.3-fat.egg/_imaging.so
Expected in: dynamic lookup

知道是 Symbol not found: _jpeg_resync_to_restart 这个问题但是不知道如何解决GOOGLE了一下发现很多人遇到了这样的问题,但是没有一个完整的解决方案。也试了很多解决方案,但是都没有解决,请大家帮忙,谢谢。
9458 次点击
所在节点    Python
15 条回复
Livid
2011-04-24 20:10:49 +08:00
PIL 依赖的包很多,不建议自己编译完整的依赖链。

通过 MacPorts 安装吧,会简单很多。
killall
2011-04-24 21:29:27 +08:00
@Livid 谢谢LIVID,
我通过PORT
sudo prot install py26-pil
装完以后 无法import..
Livid
2011-04-24 21:36:43 +08:00
/opt/local/bin/python2.6
evenkevin
2011-04-30 11:55:26 +08:00
当时安装也遇到点问题,我当时总结了下,可以参考
http://1q80prj.appspot.com/article/41
alai
2011-05-01 17:27:38 +08:00
仍然沒成功⋯⋯
killall
2011-05-01 17:47:22 +08:00
嗯,放弃了MAC自带 PYTHON 改用MACports安装可以使用了,但是现在又遇到了诡异的问题。
http://www.zhimaq.com/questions/1467/macmacports
kingwkb
2011-05-02 12:40:18 +08:00
昨天安装试了下,没遇到这个问题
http://yanghao.org/blog/archives/108
kingwkb
2011-05-02 12:42:42 +08:00
你的安装好像有问题吧
PIL-1.1.7-py2.6-macosx-10.3-fat.egg
和我的不一样
/Library/Python/2.6/site-packages/PIL-1.1.7-py2.6-macosx-10.6-universal.egg
chengdujin
2011-05-02 14:06:53 +08:00
其实最主要的问题是pil中_imaging.so的位数是x86_64 而你要去找个universal的编译就行了
chengdujin
2011-05-02 15:33:34 +08:00
刚才试了下一个肯定成功的办法:

1. sudo port py26-pil +universal
2. 两种办法:要不将/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL的内容直接拷到/Library/Python/2.6/site-packages中 要不就将前者映射到(ln)后者去
killall
2011-05-02 18:04:24 +08:00
@chengdujin 谢谢 如果依赖 MacPorts 已经安装成功了
darcy
2011-05-02 19:27:08 +08:00
这个太难搞
SSL也难搞
linsk
2011-11-01 10:02:29 +08:00
好吧,我也撞上了。

在terminal里找到了..
>>> import PIL
>>> PIL
<module 'PIL' from '/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PIL/__init__.pyc'>

python2.5 -c "from PIL import Image" 也没出现任何错误提醒。

但在GAE Luancher调试报错,
raise NotImplementedError("Unable to find the Python PIL library. Please "
NotImplementedError: Unable to find the Python PIL library. Please view the SDK documentation for details about installing PIL on your system.
skingtree
2016-05-07 16:46:44 +08:00
我是 python 新手,安装 pillow 遇上了问题搜到了这里,后来是到官网的指引下完成的。其实也就是两行命令
https://pillow.readthedocs.io/en/latest/installation.html

> brew install libtiff libjpeg webp little-cms2
> pip install Pillow

good luck~
killall
2016-05-08 16:11:02 +08:00
@skingtree 『这是一个创建于 1840 天前的主题,其中的信息可能已经有所发展或是发生改变。』 :D 3ks

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/12056

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX