解码器拉链不可用 - PIL和sorl-thumbnail

时间:2013-08-07 09:13:20

标签: python django python-imaging-library

我使用PIL,我有这个错误:

  

解码器zip不可用

在这一行:{% thumbnail design.img "511x400" crop="center" as im %}

全:

{% thumbnail design.img "511x400" crop="center" as im %}
    <img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}">
{% endthumbnail %}

我使用Django 1.5,PIL和 virtualenv

如何解决此错误?

编辑:

我试试:

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

但它仍无效

来自终端的结果:

PIL 1.1.7 SETUP SUMMARY
    --------------------------------------------------------------------
    version       1.1.7
    platform      linux2 2.7.3 (default, Sep 26 2012, 21:53:58)
                  [GCC 4.7.2]
    --------------------------------------------------------------------
    *** TKINTER support not available
    *** JPEG support not available
    *** ZLIB (PNG/ZIP) support not available
    *** FREETYPE2 support not available
    *** 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.

1 个答案:

答案 0 :(得分:1)

原始PIL糟透了!

我尝试安装所有必需的依赖项,链接所有文件,这使我花了整整一个上午,但仍然无法正常工作。

解决方案: 使用枕头

  sudo pip install PIL

然后你可以:

  $ python
  Python 2.7.4 (default, Apr 19 2013, 18:28:01) 
  [GCC 4.7.3] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> from PIL import Image
  >>>

参考: http://pythonadventures.wordpress.com/2013/05/19/problems-with-pil-use-pillow-instead/