Python图像库失败,消息“解码器JPEG不可用”- PIL

时间:2022-08-15 21:20:05

PIL does support JPEG in my system.

PIL在我的系统中支持JPEG。

Whenever I do an upload, my code is failing with:

每当我上传,我的代码就会失败:

File "PIL/Image.py", line 375, in _getdecoder
    raise IOError("decoder %s not available" % decoder_name)
IOError: decoder jpeg not available

How can I resolve this?

我如何解决这个问题?

15 个解决方案

#1


475  

libjpeg-dev is required to be able to process jpegs with pillow (or PIL), so you need to install it and then recompile pillow. It also seems that libjpeg8-dev is needed on Ubuntu 14.04

libjpeg-dev需要能够使用pillow(或PIL)处理jpeg,因此需要安装它,然后重新编译pillow。似乎在Ubuntu 14.04中也需要libjpeg8-dev

If you're still using PIL then you should really be using pillow these days though, so first pip uninstall PIL before following these instructions to switch, or if you have a good reason for sticking with PIL then replace "pillow" with "PIL" in the below).

如果你还在使用PIL,那么你现在应该真的在使用pillow了,所以在遵循这些指令切换之前,pip先将PIL卸载PIL,或者如果你有很好的理由坚持使用PIL,那么就用下面的PIL来替换pillow)。

On Ubuntu:

在Ubuntu上:

# install libjpeg-dev with apt
sudo apt-get install libjpeg-dev
# if you're on Ubuntu 14.04, also install this
sudo apt-get install libjpeg8-dev

# reinstall pillow
pip install --no-cache-dir -I pillow

If that doesn't work, try one of the below, depending on whether you are on 64bit or 32bit Ubuntu.

如果不成功,试试下面的一个,取决于你是使用64位还是32位Ubuntu。

For Ubuntu x64:

Ubuntu x64的:

sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib
sudo ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib
sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib

Or for Ubuntu 32bit:

或Ubuntu 32位:

sudo ln -s /usr/lib/i386-linux-gnu/libjpeg.so /usr/lib/
sudo ln -s /usr/lib/i386-linux-gnu/libfreetype.so.6 /usr/lib/
sudo ln -s /usr/lib/i386-linux-gnu/libz.so /usr/lib/

Then reinstall pillow:

然后重新安装枕头:

pip install --no-cache-dir -I pillow

(Edits to include feedback from comments. Thanks Charles Offenbacher for pointing out this differs for 32bit, and t-mart for suggesting use of --no-cache-dir).

(编辑以包含来自评论的反馈。感谢查尔斯·奥芬巴赫指出这一差异有32位,t-mart建议使用-不缓存目录。

#2


64  

For those on OSX, I used the following binary to get libpng and libjpeg installed systemwide:

对于OSX上的用户,我使用下面的二进制文件在系统范围内安装libpng和libjpeg:

libpng & libjpeg for OSX

用于OSX的libpng & libjpeg。

Because I already had PIL installed (via pip on a virtualenv), I ran:

因为我已经安装了PIL(通过pip在virtualenv上),我运行:

pip uninstall PIL
pip install PIL --upgrade

This resolved the decoder JPEG not available error for me.

这就解决了解码器JPEG的错误。

UPDATE (4/24/14):

更新(4/24/14):

Newer versions of pip require additional flags to download libraries (including PIL) from external sources. Try the following:

更新版本的pip需要额外的标志来从外部源下载库(包括PIL)。试试以下:

pip install PIL --allow-external PIL --allow-unverified PIL

See the following answer for additional info: pip install PIL dont install into virtualenv

查看以下的答案获取更多信息:pip安装PIL不要安装到virtualenv

UPDATE 2:

更新2:

If on OSX Mavericks, you'll want to set the ARCHFLAGS flag as @RicardoGonzales comments below:

如果在OSX Mavericks中,您将希望将ARCHFLAGS设置为@RicardoGonzales评论如下:

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install PIL --allow-external PIL --allow-unverified PIL

#3


28  

This is the only way that worked for me. Installing packages and reinstalling PIL didn't work.

这是我唯一的方法。安装包和重新安装PIL不工作。

On ubuntu, install the required package:

在ubuntu上,安装所需的包:

sudo apt-get install libjpeg-dev

(you may also want to install libfreetype6 libfreetype6-dev zlib1g-dev to enable other decoders).

(您可能还希望安装libfreetype6 libfreetype6-dev zlib1g-dev以启用其他解码器)。

Then replace PIL with pillow:

然后用PIL取代:

pip uninstall PIL
pip install pillow

#4


21  

The followed works on ubuntu 12.04:

以下是ubuntu 12.04的工作:

pip uninstall PIL
apt-get install libjpeg-dev
apt-get install libfreetype6-dev
apt-get install zlib1g-dev
apt-get install libpng12-dev
pip install PIL --upgrade

when your see "-- JPEG support avaliable" that means it works.

当您的see“—JPEG支持avaliable”时,这意味着它可以工作。

But, if it still doesn't work when your edit your jpeg image, check the python path !! my python path missed /usr/local/lib/python2.7/dist-packages/PIL-1.1.7-py2.7-linux-x86_64.egg/, so I edit the ~/.bashrc add the following code to this file:

但是,如果在编辑jpeg图像时仍然不起作用,请检查python路径!!我的python路径错过了/usr/local/ lib2.7 /python2.7/dist-packages/PIL-1.1.7-py2.7-linux-x86_64。egg/,所以我编辑~/。bashrc将以下代码添加到此文件:

Edit: export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/dist-packages/PIL-1.1.7-py2.7-linux-x86_64.egg/

编辑:出口到PYTHONPATH = $ PYTHONPATH:/ usr /地方/ lib / python2.7 / dist-packages / PIL-1.1.7-py2.7-linux-x86_64.egg /

then, finally, it works!!

最后,它工作! !

#5


16  

On Fedora 17 I had to install libjpeg-devel and afterwards reinstall PIL:

在Fedora 17上,我必须安装libjpeg-devel,然后重新安装PIL:

sudo yum install --assumeyes libjpeg-devel
sudo pip-python install --upgrade PIL

#6


14  

Rolo's answer is excellent, however I had to reinstall Pillow by bypassing pip cache (introduced with pip 7) otherwise it won't get properly recompiled!!! The command is:

Rolo的答案很好,但是我必须绕过pip缓存(与pip 7一起引入)重新安装枕头,否则它不会被正确地重新编译!!的命令是:

pip install -I --no-cache-dir -v Pillow

and you can see if Pillow has been properly configured by reading in the logs this:

你可以在日志中看到枕头是否配置正确

PIL SETUP SUMMARY
    --------------------------------------------------------------------
    version      Pillow 2.8.2
    platform     linux 3.4.3 (default, May 25 2015, 15:44:26)
                 [GCC 4.8.2]
    --------------------------------------------------------------------
    *** TKINTER support not available
    --- JPEG support available
    *** OPENJPEG (JPEG2000) support not available
    --- ZLIB (PNG/ZIP) support available
    --- LIBTIFF support available
    --- FREETYPE2 support available
    *** LITTLECMS2 support not available
    *** WEBP support not available
    *** WEBPMUX support not available
    --------------------------------------------------------------------

as you can see the support for jpg, tiff and so on is enabled, because I previously installed the required libraries via apt (libjpeg-dev libpng12-dev libfreetype6-dev libtiff-dev)

可以看到,对jpg的支持已经启用了tiff等,因为我以前通过apt安装了所需的库(libjpeg-dev libpng12-dev libfreetype6-dev libtiff-dev)

#7


12  

On Mac OS X Mavericks (10.9.3), I solved this by doing the follows:

在Mac OS X Mavericks(10.9.3)上,我通过以下方法解决了这个问题:

Install libjpeg by brew (package management system)

用brew平台安装libjpeg(包管理系统)

brew install libjpeg

酿造安装libjpeg

reinstall pillow (I use pillow instead of PIL)

重新安装枕头(我用枕头代替PIL)

pip install -I pillow

pip安装我的枕头

#8


11  

apt-get install libjpeg-dev
apt-get install libfreetype6-dev
apt-get install zlib1g-dev
apt-get install libpng12-dev

Install these and be sure to install PIL with pip because I compiled it from source and for some reason it didn't work

安装这些并确保使用pip安装PIL,因为我从源代码编译它,出于某种原因它不能工作

#9


9  

I was already using Pillow and got the same error. Tried installing libjpeg or libjpeg-dev as suggested by others but was told that a (newer) version was already installed.

我已经在用枕头了,也犯了同样的错误。尝试按照其他人的建议安装libjpeg或libjpeg-dev,但被告知已经安装了(更新的)版本。

In the end all it took was reinstalling Pillow:

最后只需要重新安装枕头:

sudo pip uninstall Pillow
sudo pip install Pillow

#10


3  

I'm too newbie to comment zeantsoi post ;(. So here his what I needed to do to solved on OSX on 10.9.1 the

我太新手了,不能评论zeantsoi的帖子。在这里,我需要做些什么来解决OSX 10。9。1的问题

IOError: decoder jpeg not available

IOError:解码器jpeg不可用

1) install Xcode tools (open your terminal and execute: xcode-select --install) - taken from this post: Can't install PIL after Mac OS X 10.9

1)安装Xcode工具(打开你的终端并执行:Xcode -select -install)——摘自本文:Mac OS X 10.9之后不能安装PIL

2) install libpng and libjpeg package (combo installer) from this link: http://ethan.tira-thompson.com/Mac_OS_X_Ports.html

2)从这个链接安装libpng和libjpeg包(组合安装程序):http://eth.tira-thompson.com/mac_os_x_ports.html。

3) reboot (not sure it was mandatory)

3)重新启动(不确定是强制的)

4) Re-install PIL with run pip install -I PIL (as I had initially installed PIL before having the issue)

4)使用run pip install - PIL重新安装PIL(正如我在出现问题之前最初安装PIL)

Hope this help and don't confuse more ...

希望这能有所帮助,不要再混淆了……

_oho

_oho

#11


2  

This question was posted quite a while ago and most of the answers are quite old too. So when I spent hours trying to figure this out, nothing worked, and I tried all suggestions in this post.

这个问题在很久以前就被提出来了,而且大多数的答案都是相当古老的。因此,当我花了几个小时试图弄明白这一点时,什么都没有奏效,我尝试了这篇文章中的所有建议。

I was still getting the standard JPEG errors when trying to upload a JPG in my Django avatar form:

当我试图在Django的头像中上传一个JPG时,仍然会遇到标准的JPEG错误:

raise IOError("decoder %s not available" % decoder_name)
OSError: decoder jpeg not available

Then I checked the repository for Ubuntu 12.04 and noticed some extra packages for libjpeg. I installed these and my problem was solved:

然后我检查了Ubuntu 12.04的存储库并注意到libjpeg的一些额外包。我安装了这些,我的问题解决了:

sudo apt-get install libjpeg62 libjpeg62-dev

Installing these removed libjpeg-dev, libjpeg-turbo8-dev, and libjpeg8-dev.

安装这些删除了libjpeg-dev、libjpeg-turbo8-dev和libjpeg8-dev。

Hope this helps someone in the year 2015 and beyond!

希望这能在2015年及以后帮助别人!

Cheers

干杯

#12


1  

Same problem here, JPEG support available but still got IOError: decoder/encoder jpeg not available, except I use Pillow and not PIL.

这里也有同样的问题,JPEG支持可用,但是仍然有IOError:解码器/编码器JPEG不可用,除了我使用枕头而不是PIL。

I tried all of the above and more, but after many hours I realized that using sudo pip install does not work as I expected, in combination with virtualenv. Silly me.

我尝试了以上所有的方法,并且尝试了更多,但是在许多小时之后,我意识到使用sudo pip安装不能像我预期的那样工作,与virtualenv结合在一起。愚蠢的我。

Using sudo effectively launches the command in a new shell (my understanding of this may not be entirely correct) where the virtualenv is not activated, meaning that the packages will be installed in the global environment instead. (This messed things up, I think I had 2 different installations of Pillow.)

使用sudo有效地在一个新的shell中启动命令(我的理解可能不是完全正确的),在这个shell中没有激活virtualenv,这意味着包将被安装到全局环境中。(事情搞砸了,我想我有两个不同的枕头装置。)

I cleaned things up, changed user to root and reinstalled in the virtualenv and now it works.
Hopefully this will help someone!

我清理了一切,将用户改为root用户,并在virtualenv中重新安装,现在它工作了。希望这能帮助某些人!

#13


1  

For Fedora

对于Fedora

Install pre-requisite
sudo dnf install make automake gcc gcc-c++ kernel-devel rpm-build libjpeg-devel zlib-devel python-devel
Now install Pillow

安装必要的sudo dnf安装使自动安装gcc gcc-c+ kernc -devel rpm-build libjpeg-devel zlib-devel -devel现在安装枕头

sudo pip install pillow

sudo pip安装枕头

Note - For libjpeg and zlib we are installing libjpeg-devel and zlib-devel packages in Fedora/CentOS/Red Hat

注意——对于libjpeg和zlib,我们正在Fedora/CentOS/Red Hat中安装libjpeg-devel和zlib-devel包

#14


0  

First I had to delete the python folders in hidden folder user/appData (that was creating huge headaches), in addition to uninstalling Python. Then I installed WinPython Distribution: http://code.google.com/p/winpython/ which includes PIL

首先,除了卸载python之外,我还必须删除隐藏文件夹用户/appData中的python文件夹(这造成了巨大的麻烦)。然后我安装了WinPython发行版:http://code.google.com/p/winpython/,其中包含PIL

#15


0  

For those on Mac OS Mountain Lion, I followed the anwser of zeantsoi, but it doesn't work.

对于那些在Mac OS Mountain Lion上的人,我追随了zeantsoi的战神,但它不管用。

I finally ended up with the solution of this post: http://appelfreelance.com/2010/06/libjpeg-pil-snow-leopard-python2-6-_jpeg_resync_to_restart/

我最终得到了这篇文章的解决方案:http://appelfreelance.com/2010/06/libjpeg- pil-雪豹-python2-6-_jpeg_resync_to_restart/

Now, I'm happily running my script for jpeg !

现在,我正在为jpeg运行我的脚本!

#1


475  

libjpeg-dev is required to be able to process jpegs with pillow (or PIL), so you need to install it and then recompile pillow. It also seems that libjpeg8-dev is needed on Ubuntu 14.04

libjpeg-dev需要能够使用pillow(或PIL)处理jpeg,因此需要安装它,然后重新编译pillow。似乎在Ubuntu 14.04中也需要libjpeg8-dev

If you're still using PIL then you should really be using pillow these days though, so first pip uninstall PIL before following these instructions to switch, or if you have a good reason for sticking with PIL then replace "pillow" with "PIL" in the below).

如果你还在使用PIL,那么你现在应该真的在使用pillow了,所以在遵循这些指令切换之前,pip先将PIL卸载PIL,或者如果你有很好的理由坚持使用PIL,那么就用下面的PIL来替换pillow)。

On Ubuntu:

在Ubuntu上:

# install libjpeg-dev with apt
sudo apt-get install libjpeg-dev
# if you're on Ubuntu 14.04, also install this
sudo apt-get install libjpeg8-dev

# reinstall pillow
pip install --no-cache-dir -I pillow

If that doesn't work, try one of the below, depending on whether you are on 64bit or 32bit Ubuntu.

如果不成功,试试下面的一个,取决于你是使用64位还是32位Ubuntu。

For Ubuntu x64:

Ubuntu x64的:

sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib
sudo ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib
sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib

Or for Ubuntu 32bit:

或Ubuntu 32位:

sudo ln -s /usr/lib/i386-linux-gnu/libjpeg.so /usr/lib/
sudo ln -s /usr/lib/i386-linux-gnu/libfreetype.so.6 /usr/lib/
sudo ln -s /usr/lib/i386-linux-gnu/libz.so /usr/lib/

Then reinstall pillow:

然后重新安装枕头:

pip install --no-cache-dir -I pillow

(Edits to include feedback from comments. Thanks Charles Offenbacher for pointing out this differs for 32bit, and t-mart for suggesting use of --no-cache-dir).

(编辑以包含来自评论的反馈。感谢查尔斯·奥芬巴赫指出这一差异有32位,t-mart建议使用-不缓存目录。

#2


64  

For those on OSX, I used the following binary to get libpng and libjpeg installed systemwide:

对于OSX上的用户,我使用下面的二进制文件在系统范围内安装libpng和libjpeg:

libpng & libjpeg for OSX

用于OSX的libpng & libjpeg。

Because I already had PIL installed (via pip on a virtualenv), I ran:

因为我已经安装了PIL(通过pip在virtualenv上),我运行:

pip uninstall PIL
pip install PIL --upgrade

This resolved the decoder JPEG not available error for me.

这就解决了解码器JPEG的错误。

UPDATE (4/24/14):

更新(4/24/14):

Newer versions of pip require additional flags to download libraries (including PIL) from external sources. Try the following:

更新版本的pip需要额外的标志来从外部源下载库(包括PIL)。试试以下:

pip install PIL --allow-external PIL --allow-unverified PIL

See the following answer for additional info: pip install PIL dont install into virtualenv

查看以下的答案获取更多信息:pip安装PIL不要安装到virtualenv

UPDATE 2:

更新2:

If on OSX Mavericks, you'll want to set the ARCHFLAGS flag as @RicardoGonzales comments below:

如果在OSX Mavericks中,您将希望将ARCHFLAGS设置为@RicardoGonzales评论如下:

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install PIL --allow-external PIL --allow-unverified PIL

#3


28  

This is the only way that worked for me. Installing packages and reinstalling PIL didn't work.

这是我唯一的方法。安装包和重新安装PIL不工作。

On ubuntu, install the required package:

在ubuntu上,安装所需的包:

sudo apt-get install libjpeg-dev

(you may also want to install libfreetype6 libfreetype6-dev zlib1g-dev to enable other decoders).

(您可能还希望安装libfreetype6 libfreetype6-dev zlib1g-dev以启用其他解码器)。

Then replace PIL with pillow:

然后用PIL取代:

pip uninstall PIL
pip install pillow

#4


21  

The followed works on ubuntu 12.04:

以下是ubuntu 12.04的工作:

pip uninstall PIL
apt-get install libjpeg-dev
apt-get install libfreetype6-dev
apt-get install zlib1g-dev
apt-get install libpng12-dev
pip install PIL --upgrade

when your see "-- JPEG support avaliable" that means it works.

当您的see“—JPEG支持avaliable”时,这意味着它可以工作。

But, if it still doesn't work when your edit your jpeg image, check the python path !! my python path missed /usr/local/lib/python2.7/dist-packages/PIL-1.1.7-py2.7-linux-x86_64.egg/, so I edit the ~/.bashrc add the following code to this file:

但是,如果在编辑jpeg图像时仍然不起作用,请检查python路径!!我的python路径错过了/usr/local/ lib2.7 /python2.7/dist-packages/PIL-1.1.7-py2.7-linux-x86_64。egg/,所以我编辑~/。bashrc将以下代码添加到此文件:

Edit: export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/dist-packages/PIL-1.1.7-py2.7-linux-x86_64.egg/

编辑:出口到PYTHONPATH = $ PYTHONPATH:/ usr /地方/ lib / python2.7 / dist-packages / PIL-1.1.7-py2.7-linux-x86_64.egg /

then, finally, it works!!

最后,它工作! !

#5


16  

On Fedora 17 I had to install libjpeg-devel and afterwards reinstall PIL:

在Fedora 17上,我必须安装libjpeg-devel,然后重新安装PIL:

sudo yum install --assumeyes libjpeg-devel
sudo pip-python install --upgrade PIL

#6


14  

Rolo's answer is excellent, however I had to reinstall Pillow by bypassing pip cache (introduced with pip 7) otherwise it won't get properly recompiled!!! The command is:

Rolo的答案很好,但是我必须绕过pip缓存(与pip 7一起引入)重新安装枕头,否则它不会被正确地重新编译!!的命令是:

pip install -I --no-cache-dir -v Pillow

and you can see if Pillow has been properly configured by reading in the logs this:

你可以在日志中看到枕头是否配置正确

PIL SETUP SUMMARY
    --------------------------------------------------------------------
    version      Pillow 2.8.2
    platform     linux 3.4.3 (default, May 25 2015, 15:44:26)
                 [GCC 4.8.2]
    --------------------------------------------------------------------
    *** TKINTER support not available
    --- JPEG support available
    *** OPENJPEG (JPEG2000) support not available
    --- ZLIB (PNG/ZIP) support available
    --- LIBTIFF support available
    --- FREETYPE2 support available
    *** LITTLECMS2 support not available
    *** WEBP support not available
    *** WEBPMUX support not available
    --------------------------------------------------------------------

as you can see the support for jpg, tiff and so on is enabled, because I previously installed the required libraries via apt (libjpeg-dev libpng12-dev libfreetype6-dev libtiff-dev)

可以看到,对jpg的支持已经启用了tiff等,因为我以前通过apt安装了所需的库(libjpeg-dev libpng12-dev libfreetype6-dev libtiff-dev)

#7


12  

On Mac OS X Mavericks (10.9.3), I solved this by doing the follows:

在Mac OS X Mavericks(10.9.3)上,我通过以下方法解决了这个问题:

Install libjpeg by brew (package management system)

用brew平台安装libjpeg(包管理系统)

brew install libjpeg

酿造安装libjpeg

reinstall pillow (I use pillow instead of PIL)

重新安装枕头(我用枕头代替PIL)

pip install -I pillow

pip安装我的枕头

#8


11  

apt-get install libjpeg-dev
apt-get install libfreetype6-dev
apt-get install zlib1g-dev
apt-get install libpng12-dev

Install these and be sure to install PIL with pip because I compiled it from source and for some reason it didn't work

安装这些并确保使用pip安装PIL,因为我从源代码编译它,出于某种原因它不能工作

#9


9  

I was already using Pillow and got the same error. Tried installing libjpeg or libjpeg-dev as suggested by others but was told that a (newer) version was already installed.

我已经在用枕头了,也犯了同样的错误。尝试按照其他人的建议安装libjpeg或libjpeg-dev,但被告知已经安装了(更新的)版本。

In the end all it took was reinstalling Pillow:

最后只需要重新安装枕头:

sudo pip uninstall Pillow
sudo pip install Pillow

#10


3  

I'm too newbie to comment zeantsoi post ;(. So here his what I needed to do to solved on OSX on 10.9.1 the

我太新手了,不能评论zeantsoi的帖子。在这里,我需要做些什么来解决OSX 10。9。1的问题

IOError: decoder jpeg not available

IOError:解码器jpeg不可用

1) install Xcode tools (open your terminal and execute: xcode-select --install) - taken from this post: Can't install PIL after Mac OS X 10.9

1)安装Xcode工具(打开你的终端并执行:Xcode -select -install)——摘自本文:Mac OS X 10.9之后不能安装PIL

2) install libpng and libjpeg package (combo installer) from this link: http://ethan.tira-thompson.com/Mac_OS_X_Ports.html

2)从这个链接安装libpng和libjpeg包(组合安装程序):http://eth.tira-thompson.com/mac_os_x_ports.html。

3) reboot (not sure it was mandatory)

3)重新启动(不确定是强制的)

4) Re-install PIL with run pip install -I PIL (as I had initially installed PIL before having the issue)

4)使用run pip install - PIL重新安装PIL(正如我在出现问题之前最初安装PIL)

Hope this help and don't confuse more ...

希望这能有所帮助,不要再混淆了……

_oho

_oho

#11


2  

This question was posted quite a while ago and most of the answers are quite old too. So when I spent hours trying to figure this out, nothing worked, and I tried all suggestions in this post.

这个问题在很久以前就被提出来了,而且大多数的答案都是相当古老的。因此,当我花了几个小时试图弄明白这一点时,什么都没有奏效,我尝试了这篇文章中的所有建议。

I was still getting the standard JPEG errors when trying to upload a JPG in my Django avatar form:

当我试图在Django的头像中上传一个JPG时,仍然会遇到标准的JPEG错误:

raise IOError("decoder %s not available" % decoder_name)
OSError: decoder jpeg not available

Then I checked the repository for Ubuntu 12.04 and noticed some extra packages for libjpeg. I installed these and my problem was solved:

然后我检查了Ubuntu 12.04的存储库并注意到libjpeg的一些额外包。我安装了这些,我的问题解决了:

sudo apt-get install libjpeg62 libjpeg62-dev

Installing these removed libjpeg-dev, libjpeg-turbo8-dev, and libjpeg8-dev.

安装这些删除了libjpeg-dev、libjpeg-turbo8-dev和libjpeg8-dev。

Hope this helps someone in the year 2015 and beyond!

希望这能在2015年及以后帮助别人!

Cheers

干杯

#12


1  

Same problem here, JPEG support available but still got IOError: decoder/encoder jpeg not available, except I use Pillow and not PIL.

这里也有同样的问题,JPEG支持可用,但是仍然有IOError:解码器/编码器JPEG不可用,除了我使用枕头而不是PIL。

I tried all of the above and more, but after many hours I realized that using sudo pip install does not work as I expected, in combination with virtualenv. Silly me.

我尝试了以上所有的方法,并且尝试了更多,但是在许多小时之后,我意识到使用sudo pip安装不能像我预期的那样工作,与virtualenv结合在一起。愚蠢的我。

Using sudo effectively launches the command in a new shell (my understanding of this may not be entirely correct) where the virtualenv is not activated, meaning that the packages will be installed in the global environment instead. (This messed things up, I think I had 2 different installations of Pillow.)

使用sudo有效地在一个新的shell中启动命令(我的理解可能不是完全正确的),在这个shell中没有激活virtualenv,这意味着包将被安装到全局环境中。(事情搞砸了,我想我有两个不同的枕头装置。)

I cleaned things up, changed user to root and reinstalled in the virtualenv and now it works.
Hopefully this will help someone!

我清理了一切,将用户改为root用户,并在virtualenv中重新安装,现在它工作了。希望这能帮助某些人!

#13


1  

For Fedora

对于Fedora

Install pre-requisite
sudo dnf install make automake gcc gcc-c++ kernel-devel rpm-build libjpeg-devel zlib-devel python-devel
Now install Pillow

安装必要的sudo dnf安装使自动安装gcc gcc-c+ kernc -devel rpm-build libjpeg-devel zlib-devel -devel现在安装枕头

sudo pip install pillow

sudo pip安装枕头

Note - For libjpeg and zlib we are installing libjpeg-devel and zlib-devel packages in Fedora/CentOS/Red Hat

注意——对于libjpeg和zlib,我们正在Fedora/CentOS/Red Hat中安装libjpeg-devel和zlib-devel包

#14


0  

First I had to delete the python folders in hidden folder user/appData (that was creating huge headaches), in addition to uninstalling Python. Then I installed WinPython Distribution: http://code.google.com/p/winpython/ which includes PIL

首先,除了卸载python之外,我还必须删除隐藏文件夹用户/appData中的python文件夹(这造成了巨大的麻烦)。然后我安装了WinPython发行版:http://code.google.com/p/winpython/,其中包含PIL

#15


0  

For those on Mac OS Mountain Lion, I followed the anwser of zeantsoi, but it doesn't work.

对于那些在Mac OS Mountain Lion上的人,我追随了zeantsoi的战神,但它不管用。

I finally ended up with the solution of this post: http://appelfreelance.com/2010/06/libjpeg-pil-snow-leopard-python2-6-_jpeg_resync_to_restart/

我最终得到了这篇文章的解决方案:http://appelfreelance.com/2010/06/libjpeg- pil-雪豹-python2-6-_jpeg_resync_to_restart/

Now, I'm happily running my script for jpeg !

现在,我正在为jpeg运行我的脚本!