查找PIL/PILLOW正在使用哪个libjpeg [英] Find which libjpeg is being used by PIL / PILLOW

查看:322
本文介绍了查找PIL/PILLOW正在使用哪个libjpeg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在两个不同的计算机上读取相同的lena.jpg文件产生两个不同的校验和时,我遇到了一个错误.

I am getting an error where reading the same lena.jpg file on two different computers yeilds two different checksums.

甚至更奇怪的是,当我运行md5sum lena.jpg时,我在两台计算机上都得到了相同的md5 sum,因此文件是相同的.

Even weirder is that when I run md5sum lena.jpg I get the same md5 sum on both machines, so the files are identical.

此外,当我加载png而不是jpeg时,数字似乎匹配.这使我相信,两台不同机器上的Pillow之间或它们用来读取jpeg文件的库之间至少存在断开连接.

Furthermore, when I load a png instead of a jpeg the numbers seem to match up. This leads me to believe there is a disconnect between Pillow on the two different machines, or at least the library they are using to read jpeg files.

有没有办法检查Pillow正在使用哪个版本的libjpeg(最好从Python内部)?

Is there any way to check which version of libjpeg is being used by Pillow (from within Python preferably)?

两台计算机都是Ubuntu,尽管其中一台是12.04,一台是14.04(我也在Mac上对其进行了测试,并获得了与14.04框相同的值)

Both of the computers are Ubuntu, although one is 12.04, and one is 14.04 (I also tested it on a mac and got the same values as the 14.04 box)

推荐答案

首先,找到您的Python安装正在使用的PIL蛋:

First, locate the PIL egg that your Python installation is using:

>>> import PIL
>>> PIL.__path__
['/usr/local/python/2.7.3/lib/python2.7/site-packages/PIL']

然后在该目录中找到_imaging.so,并使用ldd(Linux)或otool -L(OS X)来查找链接到的libjpeg版本:

Then locate _imaging.so in that directory and use ldd (Linux) or otool -L (OS X) to find out what version of libjpeg it has been linked against:

Linux

$ ldd /usr/local/python/2.7.3/lib/python2.7/site-packages/PIL/_imaging.so
    linux-gate.so.1 =>  (0x00641000)
    libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x00f00000)
    libz.so.1 => /lib/libz.so.1 (0x006f4000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x00fad000)
    libc.so.6 => /lib/libc.so.6 (0x0021b000)
    /lib/ld-linux.so.2 (0x0067e000)

Mac OS X

$ otool -L /Users/lukas/src/pillow-env/lib/python2.7/site-packages/PIL/_imaging.so
/Users/lukas/src/pillow-env/lib/python2.7/site-packages/PIL/_imaging.so:
    /usr/local/lib/libjpeg.8.dylib (compatibility version 13.0.0, current version 13.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
    /usr/local/lib/libtiff.5.dylib (compatibility version 8.0.0, current version 8.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)

这篇关于查找PIL/PILLOW正在使用哪个libjpeg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆