2012-06-30 5 views
1

저는 데비안 6을 실행 중이며 최근에 PIL을 설치했습니다.PIL zip jpeg 디코더가 런타임에는 작동하지 않지만 설치/셀프 테스트에서는 작동합니다.

나는 ZLIB 및 JPEG 라이브러리를 미리 설치 한 그들은 모두에있어는/usr/lib에 설치하는 경우

의 setup.py 파일이 라이브러리를 발견, 나는 표준 얻을 :

-------------------------------------------------------------------- 
PIL 1.1.7 SETUP SUMMARY 
-------------------------------------------------------------------- 
version  1.1.7 
platform  linux2 2.7.3 (default, Jun 29 2012, 22:38:23) 
       [GCC 4.4.5] 
-------------------------------------------------------------------- 
*** TKINTER support not available 
--- JPEG support available 
--- ZLIB (PNG/ZIP) support available 
--- FREETYPE2 support available 
--- LITTLECMS support available 

zlib 및 jpeg가 예상대로 작동합니다. selftest.py도 실행됩니다.

-------------------------------------------------------------------- 
PIL 1.1.7 TEST SUMMARY 
-------------------------------------------------------------------- 
Python modules loaded from ./PIL 
Binary modules loaded from ./PIL 
-------------------------------------------------------------------- 
--- PIL CORE support ok 
*** TKINTER support not installed 
--- JPEG support ok 
--- ZLIB (PNG/ZIP) support ok 
--- FREETYPE2 support ok 
--- LITTLECMS support ok 
-------------------------------------------------------------------- 
Running selftest: 
--- 57 tests passed. 

그래서 우리는 지금까지 기뻐하고 있습니다.

그냥 우리가 파이썬을 실행, 확인하고 ZLIB 디코더 그래서

Python 2.7.3 (default, Jun 29 2012, 22:38:23) 
[GCC 4.4.5] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import zlib 
>>> a=zlib.compress('hello world') 
>>> print zlib.decompress(a) 
hello world 

작동 테스트, 그것을 작동합니다.

그러나

, 나는 이미지 저장하려고하면

나는 (JPEG의 디코더는 사용할 수없는 하나는 제외)

JPEG로 저장하려고하면

>>> import Image 
>>> i = Image.open('a.png') 
>>> i.save('b.png') 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/usr/local/lib/python2.7/site-packages/PIL/Image.py", line 1406, in save 
    self.load() 
    File "/usr/local/lib/python2.7/site-packages/PIL/ImageFile.py", line 189, in load 
    d = Image._getdecoder(self.mode, d, a, self.decoderconfig) 
    File "/usr/local/lib/python2.7/site-packages/PIL/Image.py", line 385, in _getdecoder 
    raise IOError("decoder %s not available" % decoder_name) 
IOError: decoder zip not available 

같은 오류 내가 체크하면 Image.core을 사실, zip_decoder 또는 jpeg_decoder 특성이 없다는 것을 알았습니다.

>>> dir(Image.core) 
['__doc__', '__file__', '__name__', '__package__', 'bit_decoder', 'blend', 'convert', 
'copy', 'crc32', 'draw', 'effect_mandelbrot', 'effect_noise', 'eps_encoder', 'fill', 
'fli_decoder', 'font', 'getcodecstatus', 'getcount', 'gif_decoder', 'gif_encoder', 
'hex_decoder', 'hex_encoder', 'linear_gradient', 'map_buffer', 'msp_decoder', 'new', 
'open_ppm', 'outline', 'packbits_decoder', 'path', 'pcd_decoder', 'pcx_decoder', 
'pcx_encoder', 'radial_gradient', 'raw_decoder', 'raw_encoder', 'sun_rle_decoder', 
'tga_rle_decoder', 'tiff_lzw_decoder', 'wedge', 'xbm_decoder', 'xbm_encoder'] 

나는 (그것을 그들을 발견, 그래서 라이브러리를 찾지 못하는 설정의 문제가 아니에요)가 설치에 적절한 라이브러리를 발견하더라도, 내가보기로이 무엇인지 찾을 수 없습니다, 핵심 객체는 적절한 디코더없이 생성됩니다.

/usr/lib 디렉토리 및 .so 파일에 대한 사용 권한을 확인하면서 PIL을 여러 번 다시 설치해 보았습니다. PIL을 루트로 실행하여 문제가 있는지 확인하십시오. 그러나 아직 대답이 없습니다.

누구나 도움을받을 수 있다면 좋을 것입니다.

미리 감사드립니다.

답변

5

Pillow하지 PIL를 사용하는 문제를 해결하기위한 간단한 방법.

베개는 "친숙한"PIL 포크입니다. PIL은 파이썬 이미징 라이브러리입니다. 베개는 시작되었으며 현재 Plone 커뮤니티에서 관리하고 있습니다. 하지만 파이썬 웹 커뮤니티의 다른 많은 사람들이나 아마 다른 곳에서도 사용됩니다. 우선,이 pip uninstall PIL PIL 설치 제거합니다

,

다음 입력 pip install pillow.

+0

다행히도이 방법이 효과적이었습니다. 슬프게도 처음부터 PIL로 무엇이 진행되고 있는지 결코 알 수 없다는 것을 의미합니다. ( 도움을 주셔서 감사합니다! – Bruno