Mac OSX SL上的Buildout / Python / Django / PIL具有“异常值:未安装_imaging C模块”?

时间:2010-01-23 19:00:51

标签: python django python-imaging-library buildout

我正在使用Buildout为我的Django项目和FeinCMS。我已经在我的Mac OSX Snow Leopard上进行了本地设置,当我使用runserver时没有任何错误。但是当我在管理区域上传FeinCMS图像时,它会出现一个 “异常值:未安装_imaging C模块”错误。

我的追溯在这里:http://dpaste.com/149492/

我的buildout.cfg文件如下所示:

   [buildout]
   parts =
        zlib
        libjpeg
        PILwoTk
        django-mptt
        django-staticfiles
        django

    eggs =
        PILwoTk
        feincms

    [zlib]
    recipe = hexagonit.recipe.cmmi
    url = http://www.zlib.net/zlib-1.2.3.tar.gz
    configure-options = --shared

    [libjpeg]
    recipe = hexagonit.recipe.cmmi
    url = http://www.ijg.org/files/jpegsrc.v8.tar.gz

    [PILwoTk]
    recipe = zc.recipe.egg:custom
    find-links = http://download.zope.org/distribution/
    include-dirs =
        ${zlib:location}/include
        ${libjpeg:location}/include
    library-dirs =
        ${zlib:location}/lib
        ${libjpeg:location}/lib
    rpath =
        ${zlib:location}/lib
        ${libjpeg:location}/lib

    [django-mptt]
    recipe = infrae.subversion
    urls = http://django-mptt.googlecode.com/svn/trunk/mptt mptt

    [django-staticfiles]
    recipe = mercurialrecipe
    repository = http://bitbucket.org/jezdez/django-staticfiles/

    [django]
    recipe = djangorecipe
    version = 1.1.1
    project = recoilmedia
    eggs = ${buildout:eggs}
    extra-paths =
        ${django-mptt:location}
        ${django-staticfiles:location}

我已经在FeinCMS小组上询问过Django IRC / group,但绝对没有任何人帮助过这个问题。我在网上搜索了解决方案,但仍然没有找到一个有效的解决方案。它让我在墙上跳水,我整天都被困在了它身上。有谁可能知道问题是什么?

1 个答案:

答案 0 :(得分:2)

我今天经历了同样的事情并找到了解决方案。问题是PIL会查找32位libjpeg,Snow Leopard会默认将库编译为x86_64。这可以通过将libjpeg部分修改为如下来修复:

[libjpeg]
recipe = hexagonit.recipe.cmmi
url = http://www.ijg.org/files/jpegsrc.v8.tar.gz
environment =
  CC=gcc -arch i386

您可以通过运行以下来检查_imaging.so正在使用的库:

otool -L path/to/PIL/_imaging.so

它应该在buildout目录中输出指向libjpeg.8.dylib的行。

修改:再想一想,使用CC="gcc -arch i386" bin/buildout运行buildout也可以。如果要编译胖二进制文件,请记住使用GCC-4.0并添加CPP:CC="gcc-4.0 -arch i386 -arch ppc" CPP="gcc-4.0 -E" bin/buildout