Tôi đang làm theo hướng dẫn Django liên quan đến tải lên hình ảnh và đã gặp sự cố này. Tôi đã thử cài đặt và cài đặt lại PIL, libjpeg, và libfreetype6 nhiều lần, nhưng không có gì cho đến nay có vẻ là làm việc. Tôi đã dành vài giờ cố gắng tìm một giải pháp, và tôi rất thất vọng vào thời điểm này. Hãy giúp tôi.Bộ giải mã JPEG không có lỗi khi làm theo hướng dẫn ứng dụng ảnh Django
Dưới đây là kết quả của selftest.py sau khi tôi cài đặt lại PIL trên mac của tôi:
PIL 1.1.6 BUILD SUMMARY
--------------------------------------------------------------------
version 1.1.6
platform darwin 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
--------------------------------------------------------------------
--- TKINTER support ok
*** JPEG support not available
--- ZLIB (PNG/ZIP) support ok
*** FREETYPE2 support not available
--------------------------------------------------------------------
To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the
setup.py script.
To check the build, run the selftest.py script.
rrdhcp-10-32-44-157:Imaging-1.1.6 pfg$ python selftest.py
*****************************************************************
Failure in example: _info(Image.open("Images/lena.jpg"))
from line #24 of selftest.testimage
Exception raised:
Traceback (most recent call last):
File "./doctest.py", line 499, in _run_examples_inner
exec compile(source, "<string>", "single") in globs
File "<string>", line 1, in <module>
File "./selftest.py", line 22, in _info
im.load()
File "PIL/ImageFile.py", line 180, in load
d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
File "PIL/Image.py", line 375, in _getdecoder
raise IOError("decoder %s not available" % decoder_name)
IOError: decoder jpeg not available
1 items had failures:
1 of 57 in selftest.testimage
***Test Failed*** 1 failures.
*** 1 tests of 57 failed.
bạn cần phải cài đặt libs jpeg trước khi cài đặt PIL, có nhiều hướng dẫn cách thực hiện việc này, ví dụ: http://stackoverflow.com/questions/8915296/decoder-jpeg-not-available-pil – dzida
Nếu bạn đang sử dụng máy Mac, bạn có thể sử dụng [Brew] (http://mxcl.github.com/homebrew/) để dễ dàng cài đặt libjpeg. Tôi đã gặp khó khăn trước đó, và [liên kết này] (http://timetobefrank.blogspot.com.es/2011/05/installing-pil-on-mac-osx-with.html) cũng đã giúp. –
Lukasz, tôi đã xóa PIL, cài đặt libfreetype, zlib và libjpeg - sau đó cài đặt lại PIL và vẫn nhận được cùng một lỗi chính xác trên selftest.py ... – entrepaul