Leopard 上的 Python 与 PIL 和 Libjpeg

发布于 2024-07-08 07:14:26 字数 570 浏览 9 评论 0原文

我在获取 PIL 支持的图片时遇到问题 - 它给了我这样的信息:

IOError: decoder jpeg not available

我从二进制安装了 PIL,没有意识到我需要 libjpeg。

我通过fink安装了libjpeg和freetype2。

我尝试使用 http://timhatch.com/(页面底部)

  • 下载 PIL 1.1 中的说明重新安装 PIL .6 源代码包并已安装开发人员工具
  • 使用此补丁修补 setup.py,以便它可以找到您已有的 Freetype。

    <代码>补丁-p0 < leopard_freetype2.diff

  • sudo apt-get install libjpeg 如果你有 fink (否则,手动构建并调整路径)

但我仍然遇到同样的错误。

我使用 Leopard PPC。

I'm having trouble getting pictures supported with PIL - it throws me this:

IOError: decoder jpeg not available

I installed PIL from binary, not realizing I needed libjpeg.

I installed libjpeg and freetype2 through fink.

I tried to reinstall PIL using instructions from http://timhatch.com/ (bottom of the page)

  • Download PIL 1.1.6 source package and have the Developer Tools already installed
  • Patch setup.py with this patch so it can find the Freetype you already have.

    patch -p0 < leopard_freetype2.diff

  • sudo apt-get install libjpeg if you have fink (otherwise, build by hand and adjust paths)

But I'm still getting the same error.

I'm on Leopard PPC.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

浴红衣 2024-07-15 07:14:26

最近,我在需要 PIL 的产品 RHEL 盒子上部署 django 项目时遇到了类似的“jpeg 解码器问题”。 我下载了 PIL,并立即运行“python setup.py install”,很高兴一切正常,直到我遇到了问题。 解决方案:系统上已经安装了libjpeg,所以我安装了libjpeg-devel。 我回到 PIL 的源代码并运行“python setup.py build”,最后在输出中显示 PIL 配置是否能够检测对 jpeg、gif、freetype 等的支持,它说jpeg 支持还可以。 安装PIL后,一切正常。

I had the similar 'jpeg decoder problem' recently when deploying a django project on a product RHEL box that required PIL. I downloaded PIL, and ran 'python setup.py install' instantly, and was happy that everything was working, until I bumped into the problem. Solution: libjpeg was already installed on the system, so I installed libjpeg-devel. I went back into the source of PIL and ran 'python setup.py build', at the end of which, in the output where it shows whether PIL configure was able to detect support for jpeg, gif, freetype, etc, it said that jpeg support was ok. After installing PIL, it worked fine.

旧夏天 2024-07-15 07:14:26

我遇到了同样的问题,这个人的帖子为我提供了解决方案:

在 Imaging-1.1.6 子目录中 rm PIL 子目录和 PIL.pth 文件,

完整详细信息如下:

http://blog.tlensing.org/2008/12 /04/kill-pil-%E2%80%93-the-python-imaging-library-headache/

完成此操作后,selftest.py 工作正常。 我还应该注意,我正在使用 macports 版本的 jpeg 库,并且我已经指定 JPEG_ROOT 来指向我的 macports 根目录中的 include 和 lib 路径

I had the same problem and this guy's post provided the solution for me:

rm the PIL subdir and the PIL.pth file in the Imaging-1.1.6 subdir

full details here:

http://blog.tlensing.org/2008/12/04/kill-pil-%E2%80%93-the-python-imaging-library-headache/

After doing this, the selftest.py worked fine. I should also note that I am using the macports version of the jpeg library and I had already specified the JPEG_ROOT to point to the include and lib paths in my macports root

多像笑话 2024-07-15 07:14:26

python路径是否仍在查看旧的二进制版本的libjpeg?

如果是的话,您将需要修改它以指向新位置。

当你编译新版本的PIL时,它是否说它找到了libjpeg? 如果没有它,它会顺利编译(iirc),并且您将在包含时看到第一个麻烦迹象。

您需要在 ./configure 时调整路径。

diff 可能不适合你。 您应该进行更多测试,然后也许可以提交错误。

Is the python path still looking at the old binary version of libjpeg?

You will need to modify it to point to the new place if it is.

When you compiled the new version of the PIL did it say that it found libjpeg? It will compile happily without it (iirc) and the first sign of trouble you will see is at include time.

You will need to adjust the path at ./configure time.

The diff might just not work for you. You should test some more and then perhaps file a bug.

烟─花易冷 2024-07-15 07:14:26

如果您使用 libjpeg 构建,但自测试失败,则您可能安装了另一个 PIL,这会造成混乱。 尝试安装它,然后看看自检是否有效。

另外,OP中引用的说明的直接链接是 此处

If you build with libjpeg, but selftest fails, you probably have another install of PIL that's confusing things. Try installing it, and see if selftest works then.

Also the direct link to the instructions referenced in the OP is here

成熟的代价 2024-07-15 07:14:26

今天我已经在这个问题上坚持了好几个小时了。 我的建议是不要一次又一次地尝试和错误,除非你能在前 15 分钟内解决问题。

有一些工具可以帮助您诊断问题:

1.检查 jpeg lib 架构是否与您的机器架构匹配:

file /usr/local/lib/libjpeg.7.dylib 

2.检查 _imaging.so 是否实际链接到您编译的 jpeg lib

cd ImageSrc

python setup.py build_ext -i

otool -L PIL/_imaging.so 

3.尝试导入 _imaging.so 并查看 问题

cd PIL

python

import _imaging

4.最后,尝试从 python“site-package”目录中删除所有以前安装的 PIL*,以确保设置确实有效

python setup.py install

对我来说,这是因为我在雪豹上使用 32 位 python,并解决了 通过以下方式安装 jpeg lib:

./configure CFLAGS="-arch i386" --enable-shared --enable-static

I have stuck to this problem for quite a few hours today. And my advice is do NOT do trial and error again and again, unless u could fix the problem in first 15 minutes.

there are a few tools for you to diagnose the problem:

1.check the if jpeg lib architcture matches your machine architecture:

file /usr/local/lib/libjpeg.7.dylib 

2.check if the _imaging.so acutally linked to your compiled jpeg lib

cd ImageSrc

python setup.py build_ext -i

otool -L PIL/_imaging.so 

3.try to import _imaging.so and see what's the problem

cd PIL

python

import _imaging

4.finally, try to remove all previous installed PIL* from python "site-package" directory to make sure set up does work

python setup.py install

For me, it's due to I am using 32 bit python on snow leopard, and solved the problem by install jpeg lib in this way:

./configure CFLAGS="-arch i386" --enable-shared --enable-static
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文