无法通过Python Imaging Library找到JPEG支持 [英] Can't get Python Imaging Library to find JPEG support

查看:117
本文介绍了无法通过Python Imaging Library找到JPEG支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是在Mountain Lion(OSX 10.8.3)上.因此,我下载,构建和安装了各种所需的库.我修改了setup.py以引用正确的位置...

This is on Mountain Lion (OSX 10.8.3). So I downloaded, built, and installed the assorted required libraries. I modified setup.py to refer to the right places...

TCL_ROOT = libinclude("/usr")
JPEG_ROOT = libinclude("/usr/local")
ZLIB_ROOT = libinclude("/usr")
FREETYPE_ROOT = libinclude("/usr/local")
LCMS_ROOT = libinclude("/usr/local")

运行setup.py似乎可以工作...

And running setup.py seems to work...

airguitar:Imaging-1.1.7 chuck 597$ python setup.py build_ext -i
running build_ext
--- using frameworks at /System/Library/Frameworks
--------------------------------------------------------------------
PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------
version       1.1.7
platform      darwin 2.7.2 (default, Oct 11 2012, 20:14:37)
              [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
--------------------------------------------------------------------
--- TKINTER support available
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
--- FREETYPE2 support available
--- LITTLECMS support available
--------------------------------------------------------------------
To check the build, run the selftest.py script.

此后,我成功运行了sudo python setup.py install.但是当我进行自我测试时,我得到...

After this I successfully ran sudo python setup.py install. But when I run the self test I get...

airguitar:Imaging-1.1.7 chuck 600$ python selftest.py 
--------------------------------------------------------------------
PIL 1.1.7 TEST SUMMARY 
--------------------------------------------------------------------
Python modules loaded from ./PIL
Binary modules loaded from ./PIL
--------------------------------------------------------------------
--- PIL CORE support ok
--- TKINTER support ok
*** JPEG support not installed
--- ZLIB (PNG/ZIP) support ok
--- FREETYPE2 support ok
--- LITTLECMS support ok
--------------------------------------------------------------------
Running selftest:
*****************************************************************
Failure in example:
try:
 _info(Image.open(os.path.join(ROOT, "Images/lena.jpg")))
except IOError, v:
 print v
from line #24 of selftest.testimage
Expected: ('JPEG', 'RGB', (128, 128))
Got: decoder jpeg not available
1 items had failures:
   1 of  57 in selftest.testimage
***Test Failed*** 1 failures.
*** 1 tests of 57 failed.

请注意,自检声称我没有安装JPEG支持.

Note that the self test claims that I don't have JPEG support installed.

建议?

更新:情况越来越糟...

我怀疑问题可能出在我必须建立自己的JPEG和其他库之前,我已经运行了安装程序.因此,我尝试从干净的PIL发行版开始.现在,当我运行python setup.py build时,我最终会得到...

I suspected that perhaps the problem was that before I knew I had to build my own JPEG and other libraries, I had run the setup. So I tried to start over with a clean PIL distribution. Now when I run python setup.py build I eventually get...

clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -DHAVE_LIBJPEG -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -I/usr/local/include/freetype2 -IlibImaging -I/System/Library/Frameworks/Python.framework/Versions/2.7/include -I/usr/include -I/usr/local/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c libImaging/JpegDecode.c -o build/temp.macosx-10.8-intel-2.7/libImaging/JpegDecode.o
clang: warning: argument unused during compilation: '-mno-fused-madd'
libImaging/JpegDecode.c:118:1: error: conflicting types for 'ImagingJpegDecode'
ImagingJpegDecode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
^
libImaging/Imaging.h:415:12: note: previous declaration is here
extern int ImagingJpegDecode(Imaging im, ImagingCodecState state,
           ^
libImaging/JpegDecode.c:145:41: warning: incompatible pointer types assigning to
      'const JOCTET *' (aka 'const char *') from 'UINT8 *' (aka 'short *')
      [-Wincompatible-pointer-types]
    context->source.pub.next_input_byte = buf;
                                        ^ ~~~
libImaging/JpegDecode.c:151:49: error: 'const JOCTET *' (aka 'const char *') and
      'UINT8 *' (aka 'short *') are not pointers to compatible types
            return context->source.pub.next_input_byte - buf; 
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~
libImaging/JpegDecode.c:235:21: warning: incompatible pointer types passing
      'UINT8 *' (aka 'short *') to parameter of type 'unsigned char *'
      [-Wincompatible-pointer-types]
            state->shuffle((UINT8*) im->image[state->y + state->yoff] +
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libImaging/JpegDecode.c:262:48: error: 'const JOCTET *' (aka 'const char *') and
      'UINT8 *' (aka 'short *') are not pointers to compatible types
    return context->source.pub.next_input_byte - buf; 
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~
2 warnings and 3 errors generated.
error: command 'clang' failed with exit status 1

我不知道如何配置它来做正确的事情".帮助将不胜感激.

I have no idea how to configure this to do the 'right thing'. Help would be appreciated.

推荐答案

从此处安装- http: //ethan.tira-thompson.com/Mac_OS_X_Ports.html

重新安装PIL

这篇关于无法通过Python Imaging Library找到JPEG支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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