在 Snow Leopard 上安装 PIL——没有任何效果
我正在尝试使用 Python 2.6.1、GCC 4.2.1、PIL 1.1.7 在 Snow Leopard 上安装 PIL,并尝试使用 libjpeg6b 和 libjpeg7 - 没有任何效果。我已经从 fink 中清除了 libjpeg/pil/zlib 的所有痕迹,尝试了各种编译器选项等,并使用了 http://jetfar.com/libjpeg-and-python-imaging-pil-on-snow-leopard/ 和 http://www.brambraakman.com /blog/comments/installing_pil_in_snow_leopard_jpeg_resync_to_restart_error/ (不是链接,因为 StOv 只允许我发布一个...)
4 位潜在有用的信息:
OTOOL 没有将 libjpeg 显示为依赖项
otool -L /Library/Python/2.6/site-packages/PIL/_imaging.so
/Library/Python/2.6/site-packages/PIL/_imaging.so:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)
我收到这些奇怪的编译器消息
i686-apple-darwin10-gcc-4.2.1: -framework: linker input file unused because linking not done
i686-apple-darwin10-gcc-4.2.1: Tcl: linker input file unused because linking not done
i686-apple-darwin10-gcc-4.2.1: -framework: linker input file unused because linking not done
i686-apple-darwin10-gcc-4.2.1: Tk: linker input file unused because linking not done
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -IlibImaging -I/sw/include/freetype2 -I/sw/include -I/opt/local/include -I/System/Library/Frameworks/Python.framework/Versions/2.6/include -I/usr/local/include -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c Tk/tkImaging.c -o build/temp.macosx-10.6-universal-2.6/Tk/tkImaging.o -framework Tcl -framework Tk
In file included from /System/Library/Frameworks/Tk.framework/Headers/tk.h:78,
from Tk/tkImaging.c:51:
selftest.py 由于 _imagingmath 而失败(在我使用上面给出的第二个链接之后,在它因 _imaging 而失败之前)
Themistocles:Imaging-1.1.7 me$ python selftest.py
Traceback (most recent call last):
File "selftest.py", line 11, in <module>
from PIL import ImageMath
File "./PIL/ImageMath.py", line 19, in <module>
import _imagingmath
ImportError: No module named _imagingmath
除了 selftest.py 之外的任何内容都因 _imaging 而失败
>>> import _imaging
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Python/2.6/site-packages/PIL/_imaging.so, 2): Symbol not found: _jpeg_resync_to_restart
Referenced from: /Library/Python/2.6/site-packages/PIL/_imaging.so
Expected in: flat namespace
in /Library/Python/2.6/site-packages/PIL/_imaging.so
请帮忙!这真是太荒谬了。我什至很高兴此时能够编译不支持 jpeg 的 PIL!
I'm trying to install PIL on Snow Leopard, using Python 2.6.1, GCC 4.2.1, PIL 1.1.7, and have tried with both libjpeg6b and libjpeg7 -- nothing works. I've cleared out every trace of libjpeg/pil/zlib from fink, tried various compiler options, etc. and used http://jetfar.com/libjpeg-and-python-imaging-pil-on-snow-leopard/ and http:// www.brambraakman.com/blog/comments/installing_pil_in_snow_leopard_jpeg_resync_to_restart_error/ (not a link because StOv only lets me post one...)
4 bits of potentially useful information:
OTOOL does not show libjpeg as a dependency
otool -L /Library/Python/2.6/site-packages/PIL/_imaging.so
/Library/Python/2.6/site-packages/PIL/_imaging.so:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)
I get these weird compiler messages
i686-apple-darwin10-gcc-4.2.1: -framework: linker input file unused because linking not done
i686-apple-darwin10-gcc-4.2.1: Tcl: linker input file unused because linking not done
i686-apple-darwin10-gcc-4.2.1: -framework: linker input file unused because linking not done
i686-apple-darwin10-gcc-4.2.1: Tk: linker input file unused because linking not done
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -IlibImaging -I/sw/include/freetype2 -I/sw/include -I/opt/local/include -I/System/Library/Frameworks/Python.framework/Versions/2.6/include -I/usr/local/include -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c Tk/tkImaging.c -o build/temp.macosx-10.6-universal-2.6/Tk/tkImaging.o -framework Tcl -framework Tk
In file included from /System/Library/Frameworks/Tk.framework/Headers/tk.h:78,
from Tk/tkImaging.c:51:
selftest.py fails because of _imagingmath (after I used the second link given above, before it too failed due to _imaging)
Themistocles:Imaging-1.1.7 me$ python selftest.py
Traceback (most recent call last):
File "selftest.py", line 11, in <module>
from PIL import ImageMath
File "./PIL/ImageMath.py", line 19, in <module>
import _imagingmath
ImportError: No module named _imagingmath
Anything but selftest.py fails because of _imaging
>>> import _imaging
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Python/2.6/site-packages/PIL/_imaging.so, 2): Symbol not found: _jpeg_resync_to_restart
Referenced from: /Library/Python/2.6/site-packages/PIL/_imaging.so
Expected in: flat namespace
in /Library/Python/2.6/site-packages/PIL/_imaging.so
Please, please help! This is getting ridiculous. I'd even be happy to be able to compile PIL sans jpeg support at this point!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我最近写了一篇关于如何让 PIL、django、libjpeg 与 Snow Leopard 完美配合的文章
http://appelfreelance.com/2010/06/libjpeg-pil-snow-leopard-python2-6-_jpeg_resync_to_restart/
我也会把它复制到这里给你。
如果您没有这个,请先下载。
进入您的 shell 环境并通过运行以下命令解压
然后运行
接下来获取 PIL 并解压它
如果你已经有 PIL 我建议运行
来清理任何现有的构建,这给我带来了很多错误和白发!
在你的 settings.py 文件中运行 find JPEG_ROOT
修改它,使其看起来如下
接下来进入构建
如果 libjpeg 已成功安装,您应该能够运行 python selftest.py,而不会出现任何与“jpeg”相关的错误
如果一切成功,您应该能够通过在命令行中执行 python 来进入 python 解释器,并执行以下操作:
没有任何错误。
只是为了三次检查我的桌面上有一个简单的 jpeg。
应该可以正常工作,不会出现错误
I recently wrote an article on how to get PIL, django, libjpeg to work nicely alongside Snow Leopard
http://appelfreelance.com/2010/06/libjpeg-pil-snow-leopard-python2-6-_jpeg_resync_to_restart/
I'll copy it in here for you too.
If you don’t have this download it first.
go into your shell environment and untar by running the following
then run
Next get PIL and untar it
If you already have PIL I would recommend running
to clean any existing builds, this has caused me loads of errors and gray hairs!
in your settings.py file run find JPEG_ROOT
amend it so it looks as follows
Next move onto the build
if libjpeg is successfully installed you should be able to run python selftest.py without any errors relating to “jpeg”
if all has worked successfully you should be able to enter your python interpreter by executing python in your command line and also do the following:
without any errors.
Just to triple check I have a simple jpeg on my desktop.
should work without errors
下载 macport:
然后将其用于 pil:
我也遇到了很多麻烦,但是端口已管理。
Download macport:
Then use it for pil:
I also had a lot of trouble with this, but port managed.
当我尝试安装 PIL 时,我总是会看到几个屏幕上的 gcc 错误。在某些时候,我得到了一些工作(可能通过 MacPorts),所以现在我的解决方案是将其复制到适当的站点包(例如在新的 virtualenv 内)。
我刚刚将其发布在这里: http://blogmaker.com/ PIL-1.1.6-for-MacOSX-10.5-Leopard.zip
对我有用;我不知道它是否对其他人有用!请随时与我联系并提出建议。并且,请告诉我是否有更好的地方可以发布它。 PIL 既很酷又很麻烦;如果能有一个明确的支持场所就好了。还有其他与 PIL 相关的问题我从未解决过。
I've always gotten several screens worth of gcc errors when trying to install PIL. At some point I got something working (perhaps via MacPorts), so now my solution is to copy it to the appropriate site-packages (e.g. inside a new virtualenv).
I just posted it here: http://blogmaker.com/PIL-1.1.6-for-MacOSX-10.5-Leopard.zip
Works for me; I have no idea whether it will work for anyone else! Feel free to contact me with suggestions. And, let me know if there's a better place I should post it. PIL is both very cool and a royal hassle; it would be nice to have a definitive place for support. There are other PIL-related issues that I never solved.