Python Image Library error

Source: Internet
Author: User
Tags plone virtualenv

False Decoder zip not available

Ioerror:cannot identify image file ' Tmp_20.png '

In the boss's eyes, the problem one after another appeared, and then although resolved, feel bad AH

The first question is

--------------------------------------------------------------------
pil 1.1.7 SETUP SUMMARY
------------ --------------------------------------------------------
version       1.1.7
platform      linux2 2.7.5+ ( Default, Sep 2013, 13:48:49)
              [GCC 4.8.1]
--------------------------------------------------------------- -----
* * * * tkinter support Not available
* * * JPEG support Not available
* * ZLIB (Png/zip) Support not Availab Le
* * * * FREETYPE2 support Not available
* * LITTLECMS support not available
---------------------------- ----------------------------------------

I'm not saving it as a PNG file, hint false decoder zip not available

Run under Windows good, but Linux is not, and then finally found that I was not using Windows PIL, but pillow

See this piece of article only found http://wangye.org/blog/archives/752/

Reproduced:

Configured Debian Web server, through Virtualenv build the Pyramid project, most of the code runs quite normal, to a code program error, check log to get the following Python exception:

Importerror:no module named PiL

But I pil clearly through the Easy_install directly installed Ah, turn to the network to find such a solution "the problem with installing PIL using virtualenv or buildout", The original meaning is that the PIL version on the PyPI is incompatible with the setuptools, so it cannot be easy_install normal installation, you must specify a compatible version of the URL installation, such as the following command:

Install --no-index-f http://dist.plone.org/thirdparty/ u pil

After such a toss, do test down import PIL will not be an error, but the original program is still not normal operation, continue to check the log after the following exception:

Importerror:the _imagingft C module is not installed

Search the network, most of the compiler installation PIL, the system is missing the library file caused by the following command to install the possible package or library files:

sudo apt-get Install libjpeg libjpeg-dev libfreetype6 Libfreetype6-dev

Then recompile the download PIL, which prompts you with the following warning:

--------------------------------------------------------------------
* * * tkinter support not available (TCL/TK 8.4 libraries needed)
* * * JPEG support Not available
* * ZLIB (Png/zip) support not available
* * * FREETYPE2 su Pport not available
--------------------------------------------------------------------to
add a missing option, make sure your have the required
library, and set the corresponding ROOT variable in the
setup.py script.

All the necessary libraries still prompt support not available, stating that the method of installing the advance library just now is useless and tangled up.

Search the network, mostly for Ubuntu solution, but Kung fu not negative, or let me find the solution under Debian "PIL zip jpeg decoders not working on runtime but work on Install/sel Ftest ", now share it:

In fact, the easiest way is to use the command pip uninstall PiL Uninstall the existing PIL, and then install the fork version of PiL Pillow, which is a "friendly" (friendly) PiL version, maintained by the Plone community, mainly for web development.

Install Pillow

OK, uninstall the previous official PIL, and after installing pillow, all the problems are resolved. And then something went wrong.

This is cannot identify image file ' Tmp_20.png '

This is the image library when the load of the problem, and then in fact very simple is

From PIL import Image
You can replace the import image.

Related Article

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.