“IOError: decoder zip not available” : Ubuntu Python PIL

前端 未结 5 1249
予麋鹿
予麋鹿 2020-12-17 19:09

I am trying to get the sample heatmap.py running from: http://jjguy.com/heatmap/

#image.py
import heatmap
import random

if __name__ == \"__main__\":    
            


        
相关标签:
5条回答
  • 2020-12-17 19:19

    This worked Perfectly for me:

    apt-get install libjpeg62 libjpeg62-dev zlib1g-dev libfreetype6 libfreetype6-dev
    

    In x86_64:

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

    In i386:

    ln -s /usr/lib/i386-linux-gnu/libz.so /usr/lib/
    ln -s /usr/lib/i386-linux-gnu/libfreetype.so.6 /usr/lib/
    ln -s /usr/lib/i386-linux-gnu/libjpeg.so /usr/lib/
    
    
    pip install -U PIL --allow-external PIL --allow-unverified PIL
    pip install -I pillow
    
    0 讨论(0)
  • 2020-12-17 19:27

    Even though my PIL was up to date, I resolved this on Ubuntu 12.04 with:

    pip uninstall PIL
    pip install PIL
    
    0 讨论(0)
  • 2020-12-17 19:36

    even you test with

    from PIL import image

    is okay, but there is still error on save/decode methods.

    you can try my steps: (base on my case, openerp 7 with ubuntu 13.10)

    1. remove python image
    2. locate your libz
    3. reinstall PIL

    check it http://febru.soluvas.com/2014/03/solved-openerp-7-ioerror-decoder-zip.html

    0 讨论(0)
  • 2020-12-17 19:38

    I just encountered a similar issue caused by having both PIL (installed through the python pip installer) and the python-imaging package installed via apt-get. When I removed the extra version from pip that resolved it for me.

    If you installed PIL from source or using pip then you might have the same problem.

    When I was building PIL I also discovered that I had to link over the libraries to /usr/lib. That might resolve the not supported messages in your log above.

    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
    
    0 讨论(0)
  • 2020-12-17 19:39

    I remember arriving at the exact same solution as Kris did when installing PIL on 64 bit systems.

    However nowadays I would recommend using Pillow (pip install pillow) instead of PIL. Pillow is simply a fork of PIL with more frequent releases and less issues like the one you're experiencing.

    If you're on Ubuntu I think you need zlib1g-dev and libjpeg-dev installed before installing PIL/Pillow so that you get support for jpeg/png built in.

    0 讨论(0)
提交回复
热议问题