Can't get PIL to support any images

2019-05-23 07:50发布

问题:

After installing PIL with pip install PIL under Ubuntu 11.10, the summary tells me "not available" on all items.

I've read through several "answers" like http://obroll.com/install-python-pil-python-image-library-on-ubuntu-11-10-oneiric/

which essentially tells me the same thing: Install PIL after libjpeg.

I still can't get it to work. (I'm a novice with ubuntu)

Any ideas?

Copy/Paste from the summary:

--------------------------------------------------------------------
PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------
version       1.1.7
platform      linux2 2.7.2+ (default, Oct  4 2011, 20:03:08)

              [GCC 4.6.1]
--------------------------------------------------------------------
*** TKINTER support not available
*** JPEG support not available
*** ZLIB (PNG/ZIP) support not available
*** FREETYPE2 support not available
*** LITTLECMS support not available
--------------------------------------------------------------------

回答1:

Finaly got it working. My experience was that even though I installed in the correct order, PIL still could not find libjpeg.

What I did:

  1. make sure libjpeg8 and libjpeg8-dev is installed and find out where it is installed with "locate libjpeg"
  2. pip install --no-install PIL" -> downloads the install files
  3. edit setup.py from the virtual environment's build directory and set JPEG_ROOT. In my case: JPEG_ROOT = "/usr/lib/i386-linux-gnu/"
  4. "pip install PIL" -> will now install PIL with the modified setup.py and find the libjpeg.


回答2:

PIL works on my machine. My possibly relevant installed packages (dpkg --get-selections | grep jpg) are:

libjpeg-progs
libjpeg62
libjpeg62:i386
libjpeg62-dev
libjpeg8
libmjpegtools-1.9
libopenjpeg2

So you could try just installing the lot and reinstalling PIL. Not a very insightful answer I'm afraid.