【问题标题】:PIL with Python 2.6.5 on Snow Leopard Install Issues在雪豹安装问题上使用 Python 2.6.5 的 PIL
【发布时间】:2011-03-07 14:52:42
【问题描述】:

我无计可施。我有一个带有 numpy 和 scipy 的 python 2.6.5 的工作安装。我想用它来做一些需要导入图像的简单 PCA。好吧,我认为 PIL 是解决这个问题的方法。因此,按照指南,我下载并安装了 libjpeg6-b。然后我使用了以下命令

tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
cp /usr/share/libtool/config/config.sub .
cp /usr/share/libtool/config/config.guess .
./configure --enable-shared --enable-static
make

我搬到了我下载 PIL 1.1.7 的地方并做了以下事情:

tar zxvf Imaging-1.1.7.tar.gz
cd Imaging-1.1.7
(edit the setup.py file to find libjpeg)
python setup.py build
python setup.py install

然后我尝试导入 _imaging 并得到著名的 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):未找到符号:_jpeg_resync_to_restart 引用自:/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 预期:动态查找错误。

我已经尝试了大部分/所有解决方案,但没有取得太大成功。在我将架构限制为 i386 后,我在 _imaging.so 上运行了 otool 并得到:

Thomas$ otool -L /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so:

/usr/lib/libSystem.B.dylib(兼容版本1.0.0,当前版本125.2.0)

此外,当我运行 pip 并得到这个输出时

    --------------------------------------------------------------------
PIL 1.1.6 BUILD SUMMARY
--------------------------------------------------------------------
version       1.1.6
platform      darwin 2.6.5 (r265:79359, Mar 24 2010, 01:32:55)
              [GCC 4.0.1 (Apple Inc. build 5493)]
--------------------------------------------------------------------
--- TKINTER support ok
--- JPEG support ok
--- ZLIB (PNG/ZIP) support ok
--- FREETYPE2 support ok
--------------------------------------------------------------------
To check the build, run the selftest.py script.

适用于 PIL 1.1.6。

我尝试切换到 gcc 4.0 并同时编译 libjpeg 和 PIL。

任何帮助将不胜感激。另外,如果您需要更多信息,请随时询问。

【问题讨论】:

    标签: python python-imaging-library


    【解决方案1】:

    你知道 Macports(或 Fink)吗?安装软件和软件包的最简单方法是通过 Macports。或者,您可以查看 Macports 的 Portfiles,看看它们是如何编译这些库的。

    【讨论】:

      【解决方案2】:

      你也可以使用pip来安装镜像

      用户 easy_install 安装 pip

      easy_install pip
      点安装http://effbot.org/downloads/Imaging-1.1.6.tar.gz

      或者,如果这对您没有帮助,我写了一篇关于如何让 PIL、libjpeg、_imaging 与 python 2.6 和雪豹一起工作的文章

      http://appelfreelance.com/2010/06/libjpeg-pil-snow-leopard-python2-6-_jpeg_resync_to_restart/

      【讨论】:

        猜你喜欢
        • 2011-08-03
        • 1970-01-01
        • 2010-11-26
        • 2011-01-27
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-11-30
        • 2010-12-09
        相关资源
        最近更新 更多