推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
killall
V2EX  ›  Python

MAC上安装 PIL库的问题,有同学知道吗?

  •  
  •   killall · Apr 24, 2011 · 10553 views
    This topic created in 5498 days ago, the information mentioned may be changed or developed.
    系统版本:os x 10.6.7
    python:2.6
    安装的PIL库版本:PIL 1.1.7
    libjpeg: v8c

    在python setup.py build 的时候系统已经提示:

    --- TKINTER support available
    --- JPEG support available
    --- ZLIB (PNG/ZIP) support available
    --- FREETYPE2 support available
    --- LITTLECMS support available
    安装完成后在web.py中使用的时候系统提示:
    The _imaging C module is not installed

    然后我进入控制台

    python -v
    import Image
    import _imaging

    系统返回错误信息:
    import _imaging
    dlopen("/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL-1.1.7-py2.6-macosx-10.3-fat.egg/_imaging.so", 2);
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL-1.1.7-py2.6-macosx-10.3-fat.egg/_imaging.so, 2): Symbol not found: _jpeg_resync_to_restart
    Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL-1.1.7-py2.6-macosx-10.3-fat.egg/_imaging.so
    Expected in: dynamic lookup

    知道是 Symbol not found: _jpeg_resync_to_restart 这个问题但是不知道如何解决GOOGLE了一下发现很多人遇到了这样的问题,但是没有一个完整的解决方案。也试了很多解决方案,但是都没有解决,请大家帮忙,谢谢。
    15 replies    2016-05-08 16:11:02 +08:00
    Livid
        1
    Livid  
    MOD
    PRO
       Apr 24, 2011
    PIL 依赖的包很多,不建议自己编译完整的依赖链。

    通过 MacPorts 安装吧,会简单很多。
    killall
        2
    killall  
    OP
       Apr 24, 2011
    @Livid 谢谢LIVID,
    我通过PORT
    sudo prot install py26-pil
    装完以后 无法import..
    Livid
        3
    Livid  
    MOD
    PRO
       Apr 24, 2011
    /opt/local/bin/python2.6
    evenkevin
        4
    evenkevin  
       Apr 30, 2011
    当时安装也遇到点问题,我当时总结了下,可以参考
    http://1q80prj.appspot.com/article/41
    alai
        5
    alai  
       May 1, 2011
    仍然沒成功⋯⋯
    killall
        6
    killall  
    OP
       May 1, 2011
    嗯,放弃了MAC自带 PYTHON 改用MACports安装可以使用了,但是现在又遇到了诡异的问题。
    http://www.zhimaq.com/questions/1467/macmacports
    kingwkb
        7
    kingwkb  
       May 2, 2011
    昨天安装试了下,没遇到这个问题
    http://yanghao.org/blog/archives/108
    kingwkb
        8
    kingwkb  
       May 2, 2011
    你的安装好像有问题吧
    PIL-1.1.7-py2.6-macosx-10.3-fat.egg
    和我的不一样
    /Library/Python/2.6/site-packages/PIL-1.1.7-py2.6-macosx-10.6-universal.egg
    chengdujin
        9
    chengdujin  
       May 2, 2011
    其实最主要的问题是pil中_imaging.so的位数是x86_64 而你要去找个universal的编译就行了
    chengdujin
        10
    chengdujin  
       May 2, 2011
    刚才试了下一个肯定成功的办法:

    1. sudo port py26-pil +universal
    2. 两种办法:要不将/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL的内容直接拷到/Library/Python/2.6/site-packages中 要不就将前者映射到(ln)后者去
    killall
        11
    killall  
    OP
       May 2, 2011
    @chengdujin 谢谢 如果依赖 MacPorts 已经安装成功了
    darcy
        12
    darcy  
       May 2, 2011 via iPhone
    这个太难搞
    SSL也难搞
    linsk
        13
    linsk  
       Nov 1, 2011
    好吧,我也撞上了。

    在terminal里找到了..
    >>> import PIL
    >>> PIL
    <module 'PIL' from '/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PIL/__init__.pyc'>

    python2.5 -c "from PIL import Image" 也没出现任何错误提醒。

    但在GAE Luancher调试报错,
    raise NotImplementedError("Unable to find the Python PIL library. Please "
    NotImplementedError: Unable to find the Python PIL library. Please view the SDK documentation for details about installing PIL on your system.
    skingtree
        14
    skingtree  
       May 7, 2016
    我是 python 新手,安装 pillow 遇上了问题搜到了这里,后来是到官网的指引下完成的。其实也就是两行命令
    https://pillow.readthedocs.io/en/latest/installation.html

    > brew install libtiff libjpeg webp little-cms2
    > pip install Pillow

    good luck~
    killall
        15
    killall  
    OP
       May 8, 2016
    @skingtree 『这是一个创建于 1840 天前的主题,其中的信息可能已经有所发展或是发生改变。』 :D 3ks
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1061 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 18:42 · PVG 02:42 · LAX 11:42 · JFK 14:42
    ♥ Do have faith in what you're doing.