【问题标题】:Python PIL JPEG support works on Heroku but not locallyPython PIL JPEG 支持适用于 Heroku,但不适用于本地
【发布时间】:2013-11-10 19:43:20
【问题描述】:

为了让我在 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

【问题讨论】:

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


    【解决方案1】:

    尝试使用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 中所述。

    【讨论】:

    • 嘿,谢谢,我以前看过这篇文章,但我认为我没有正确的包列表。我只是不断收到Unable to locate package libjpeg。验证我在 ubuntu 12.04 上,我刚刚做了一个apt-get update。编辑:我能够安装除 libjpeg 之外的所有其他软件包。 libjpeg-dev 工作得很好。
    • 好的,让它工作。不需要 libjpeg,所以我只安装了 libjpeg-dev 和其他软件包,做了符号链接,一切都很好。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-08-02
    • 1970-01-01
    • 2022-01-26
    • 1970-01-01
    • 2016-10-10
    • 2014-02-26
    • 1970-01-01
    相关资源
    最近更新 更多