ubuntu14.04 Installing the PIL Library Oerror:decoder JPEG not available solution

Source: Internet
Author: User

Appear

Oerror:decoder JPEG not available

The reason is that there is no JPEG library, and to support PNG images, but also to install ZLIB, FREETYPE2, littlecms library files.

The first solution: Complete installation of these libraries!!!!

Installation method: http://cn-popeye.iteye.com/blog/1236691 in this blog, the author described in detail and installation methods, I just copied here.

1. Install zlib (Ubuntu official Source no zlib, don't think Apt-get)

Download Zlib, (Zlib.net has wall, can go to sf.net), url:http://sourceforge.net/projects/libpng/files/zlib/1.2.5/zlib-1.2.5.tar.gz/ Download?use_mirror=superb-dca2

$ TAR-XVZF zlib-1.2.5.tar.gz
$ CD zlib-1.2.5
$./configure--prefix=/usr/local
$ make
$ sudo make install

2.install png (Forget Apt-get bar)

$ wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.5.6.tar.gz (if the file does not exist, browse the/src/directory to find the latest version)
$ TAR-XVZF libpng-1.5.6.tar.gz
$ CD libpng-1.5.6
$./configure--prefix=/usr/local
$ make
$ sudo make install

3.install FreeType (Forget Apt-get bar)

$ wget http://nchc.dl.sourceforge.net/project/freetype/freetype2/2.4.7/freetype-2.4.7.tar.gz
$ TAR-XVZF freetype-2.4.7.tar.gz
$ CD freetype-2.4.7/
$./configure--prefix=/usr/local
$ make
$ make Install

4.install jpeg (Forget Apt-get bar)

$ wget http://www.ijg.org/files/jpegsrc.v8c.tar.gz
$ TAR-XVZF jpegsrc.v8c.tar.gz
$ CD jpeg-8c/
$./configure--prefix=/usr/local
$ make
$ sudo make install

Then, install the required Devel library (now it's time to think of Apt-get)!!!!!!!!

$ sudo apt-get install Libjpeg8-dev

$ sudo apt-get install Libpng12-dev

$ sudo apt-get install Libfreetype6-dev

$ sudo apt-get install Zlib1g-dev

Now, install PIL (Python Imaging Library )!!!!!!!!

$ wget http://effbot.org/downloads/Imaging-1.1.7.tar.gz
$ TAR-XVZF imaging-1.1.7.tar.gz
$ CD imaging-1.1.7/

To modify the setup.py file:

$ nano setup.py

Modify the following:
Jpeg_root = "/usr/local/lib"
Zlib_root = "/usr/local/lib"
Freetype_root = "/usr/local/lib"

Check if support:

$ python setup.py build_ext-i
running Build_ext
--------------------------------------------------------------------
PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------
version 1.1.7
platform linux2 2.7.1+ (r271:86832, APR, 18:13:53)
[GCC 4.5.2]
--------------------------------------------------------------------
* * * TKINTER support not available
---JPEG support available-----------------------> ok! !!!!!!!
---ZLIB (png/zip) support available-----------------------> ok! !!!!!!!
---FREETYPE2 support available-----------------------> ok!!!!!!!!
* * * LITTLECMS 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.

Official installation:

$ python setup.py Build
$ sudo python setup.py install

This completes the installation. Bloggers are also installed in this way, can be used completely. (I was so excited after compiling that I forgot to install it, so I couldn't use it, and eventually I found the problem.) This approach fundamentally solves the problem)

Note: If it is not installed in this way, you must remember to put the jpeg,zlib,freetype,littlecms of the library link to the PIL inside, otherwise can not be called.

Second Solution:

Also seen on the Internet, is to find a replacement of the library pillow. I am not here to write the specific method, you can go to the original text to see. In the original text mentioned the author saw the article "PIL Zip JPEG decoders not working on the runtime but working on Install/selftest" mentioned in the question, said installed those libraries, display PIL normal support, but The program still does not work, I guess the reason is not to add the library to the PIL.

The original link: solve the virtualenv installation of Python PIL support does not available problem

The third solution:

Is the "Ubuntu installation PiL module" in the proposed.

Deploy Tornaod apps on Ubuntu Linux. When processing the picture, I found the image module error:

Ioerror:decoder JPEG not available

Tip The JPEG module is not installed.

Uninstall PIL First (I installed it with PIP, other installation, please resolve it as appropriate.) )

sudo pip uninstall PIL

Install Ubuntu packaged python-imaging module, you can successfully solve.

sudo apt-get install python-imaging

Finally, this thing is completely done ~

!!!!!!!! The!!!!!!!

ubuntu14.04 Installing the PIL Library Oerror:decoder JPEG not available solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.