Python PIL : IOError: decoder jpeg not available

时间:2023-03-09 01:33:04
Python PIL : IOError: decoder jpeg not available
The first thing I check when I got this error was to check if libjpeg was installed. 
Lets try this
  1. sudo apt-get install libjpeg libjpeg-dev
  2. sudo apt-get install libfreetype6 libfreetype6-dev

download jpeg source

  1. tar -xzvf jpegsrc.v8c.tar.gz
  2. cd jpeg-6b/
  3. ./configure
  4. make
  5. sudo make install

So download Python Imaging Library 1.1.7 Source Kit (all platforms)

The after run the setup.py install, check if the support was ok

  1. --------------------------------------------------------------------
  2. *** TKINTER support not available (Tcl/Tk 8.5 libraries needed)
  3. --- JPEG support available
  4. --- ZLIB (PNG/ZIP) support available
  5. *** FREETYPE2 support not available
  6. --- LITTLECMS support available
  7. --------------------------------------------------------------------

If not, in setup.py in PIL I had to change the path of :

  1. JPEG_ROOT = None
  2. ZLIB_ROOT = None

to

  1. JPEG_ROOT = libinclude("/usr/")
  2. ZLIB_ROOT = libinclude("/usr/")