Python PIL JPEG支持适用于Heroku,但不适用于本地

时间:2013-10-30 23:26:43

标签: python ubuntu heroku python-imaging-library pip

为了让我在Heroku上获得PIL JPEG支持,我必须使用这里找到的PIL的分叉/编辑版本hg + https://bitbucket.org/etienned/pil-2009-raclette/#egg=PIL

它告诉我JPEG support available Heroku但是在我当地的Ubuntu 12.04上我得到了*** JPEG support not available

我在ubuntu机器上错过了某些软件包吗?这是使用pip和requirements.txt安装的转储

的Heroku

-----> Installing dependencies using Pip (1.3.1)

 ...

       Obtaining PIL from hg+https://bitbucket.org/etienned/pil-2009-raclette/#egg=PIL (from -r requirements.txt (line 48))
         Updating ./.heroku/src/pil clone
warning: bitbucket.org certificate with fingerprint 24:9c:45:8b:9c:aa:ba:55:4e:01:6d:58:ff:e4:28:7d:2a:14:ae:3b not verified (check hostfingerprints or web.cacerts config setting)
         Running setup.py egg_info for package PIL

       Installing collected packages: PIL
         Running setup.py develop for PIL

           --------------------------------------------------------------------
           PIL 1.2a0 SETUP SUMMARY
           --------------------------------------------------------------------
           version       1.2a0
           platform      Python 2.7.4 (default, Apr  6 2013, 22:14:13)
                         [GCC 4.4.3] on linux2
           --------------------------------------------------------------------
           *** TKINTER support not available
           --- JPEG support available
           *** WEBP support not available
           --- ZLIB (PNG/ZIP) support available
           --- FREETYPE2 support available
           --- LITTLECMS support available
           --------------------------------------------------------------------
           To add a missing option, make sure you have the required
           library, and set the corresponding ROOT variable in the
           setup.py script.

           To check the build, run the selftest.py script.
           Creating /app/.heroku/python/lib/python2.7/site-packages/PIL.egg-link (link to .)
           PIL 1.2a0 is already the active version in easy-install.pth
           Installing pilfile.py script to /app/.heroku/python/bin
           Installing pilfont.py script to /app/.heroku/python/bin
           Installing pilconvert.py script to /app/.heroku/python/bin
           Installing pilprint.py script to /app/.heroku/python/bin
           Installing pildriver.py script to /app/.heroku/python/bin

           Installed /app/.heroku/src/pil
       Successfully installed PIL

本地(Ubuntu)

(venv)robbie@ubuntu:~/git/myproject$ pip install -r requirements.txt 

...

Obtaining PIL from hg+https://bitbucket.org/etienned/pil-2009-raclette/#egg=PIL (from -r requirements.txt (line 48))
  Updating ./venv/src/pil clone
warning: bitbucket.org certificate with fingerprint 24:9c:45:8b:9c:aa:ba:55:4e:01:6d:58:ff:e4:28:7d:2a:14:ae:3b not verified (check hostfingerprints or web.cacerts config setting)
  Running setup.py egg_info for package PIL

Requirement already satisfied (use --upgrade to upgrade): static in ./venv/lib/python2.7/site-packages (from dj-static==0.0.5->-r requirements.txt (line 12))
Requirement already satisfied (use --upgrade to upgrade): tablib in ./venv/lib/python2.7/site-packages (from django-import-export==0.1.4->-r requirements.txt (line 20))
Requirement already satisfied (use --upgrade to upgrade): diff-match-patch in ./venv/lib/python2.7/site-packages (from django-import-export==0.1.4->-r requirements.txt (line 20))
Installing collected packages: PIL
  Running setup.py develop for PIL

    --------------------------------------------------------------------
    PIL 1.2a0 SETUP SUMMARY
    --------------------------------------------------------------------
    version       1.2a0
    platform      Python 2.7.3 (default, Apr 10 2013, 06:20:15)
                  [GCC 4.6.3] on linux2
    --------------------------------------------------------------------
    *** TKINTER support not available
    *** JPEG support not available
    *** WEBP 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.

    To check the build, run the selftest.py script.
    Creating /home/robbie/git/myproject/venv/lib/python2.7/site-packages/PIL.egg-link (link to .)
    Adding PIL 1.2a0 to easy-install.pth file
    Installing pildriver.py script to /home/robbie/git/myproject/venv/bin
    Installing pilprint.py script to /home/robbie/git/myproject/venv/bin
    Installing pilfile.py script to /home/robbie/git/myproject/venv/bin
    Installing pilconvert.py script to /home/robbie/git/myproject/venv/bin
    Installing pilfont.py script to /home/robbie/git/myproject/venv/bin

    Installed /home/robbie/git/myproject/venv/src/pil
Successfully installed PIL

1 个答案:

答案 0 :(得分:4)

尝试执行sudo apt-get install libjpeg libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev,然后对这些库进行符号链接:

ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib
ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib
ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib

并重新运行pip install,如this post中所述。

相关问题