PIL /JPEG Library: “decoder jpeg not available”

2019-03-07 18:05发布

I tried to use PIL to do some JPEG work in my django app with PIL but I'm getting this IOError.. not sure what to do.

""decoder jpeg not available""

Am I missing the JPEG decoder from my server? If so, how do I fix it?

8条回答
倾城 Initia
2楼-- · 2019-03-07 18:44

On Debian distributions use libjpeg62-turbo-dev instead of libjpeg8-dev

查看更多
ゆ 、 Hurt°
3楼-- · 2019-03-07 18:48

I don't have sudo privileges, because I am on a shared bluehost server. So I can't run any of those sudo apt-get jpeg commands. I ended up running

pip uninstall pil
pip install pillow

and apparently pillow was able to find support for jpegs.

查看更多
Viruses.
4楼-- · 2019-03-07 18:48

There is a selftest.py in your Imaging installation folder, try:

python selftest.py

you will see something like that:

--------------------------------------------------------------------
*** PIL CORE support not installed
*** TKINTER support not installed
--- JPEG support ok
--- ZLIB (PNG/ZIP) support ok
*** FREETYPE2 support not installed
*** LITTLECMS support not installed
--------------------------------------------------------------------

if JPEG support not available, Centos:

yum install libjpeg-devel
yum install freetype-devel 
yum install libpng-devel
查看更多
【Aperson】
5楼-- · 2019-03-07 18:52
We Are One
6楼-- · 2019-03-07 18:55

For mac's users, You can download the library from here: http://ethan.tira-thompson.com/Mac_OS_X_Ports.html. Then, uninstall and install PIL

查看更多
我想做一个坏孩纸
7楼-- · 2019-03-07 18:59

You need to install jpeg library first and reinstall your PIL. For example, I'm using CentOS, to install libjpeg, I run

sudo yum install -y libjpeg-devel

It depends on what kind of linux you are using. And here you have to remove the old PIL

rm -rf /usr/lib/python2.6/site-packages/PIL-1.1.7-py2.6-linux-x86_64.egg/

Then install the PIL

sudo easy_install PIL
查看更多
登录 后发表回答