本文介绍了具有“异常值:未安装_imaging C模块".在Mac OSX SL上与Buildout/Python/Django/PIL一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过FeinCMS将Buildout用于我的Django项目.我已经在Mac OSX Snow Leopard上在本地进行了很好的设置,使用runserver时完全没有出现错误.但是,当我在管理区域中使用FeinCMS上传图像时,会出现一个异常值:未安装_imaging C模块"错误.

I'm using Buildout for my Django projects, with FeinCMS. I've got it setup great locally on my Mac OSX Snow Leopard, with no errors coming up at all when I use runserver. But when I upload an image with FeinCMS in the admin area it comes up with a "Exception Value: The _imaging C module is not installed" error.

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

我的buildout.cfg文件如下:

My buildout.cfg file looks like this:

   [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上询问过,但在任何方面都没有任何帮助.我在网上搜索了所有解决方案,但仍然没有找到可行的解决方案.它使我无法自拔,我整日都被困在上面.有谁知道这是什么问题吗?

I've asked on FeinCMS group, on Django IRC/group but with absolutely no help from anyone on what this can be. I've searched all over the net for solutions and still haven't found one that works. It's diving me up the wall, I've been stuck on it all day. Does anyone possibly know what the problem is?

推荐答案

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

I have gone through the same thing today and found a solution. The problem is that PIL will look for 32-bit libjpeg and Snow Leopard will compile the library as x86_64 by default. This could be fixed by modifying your libjpeg section to look like this:

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

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

You can check which library _imaging.so is using by running:

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

它应该在您的构建目录中输出指向libjpeg.8.dylib的行.

It should output the line pointing to libjpeg.8.dylib in your buildout directory.

编辑:再次考虑,使用CC="gcc -arch i386" bin/buildout运行扩展也可以.如果要编译胖二进制文件,请记住使用GCC-4.0并添加CPP:CC="gcc-4.0 -arch i386 -arch ppc" CPP="gcc-4.0 -E" bin/buildout.

Edit: On a second thought, running buildout with CC="gcc -arch i386" bin/buildout will also works. If you want to compile a fat binary, remember to use GCC-4.0 and add CPP: CC="gcc-4.0 -arch i386 -arch ppc" CPP="gcc-4.0 -E" bin/buildout.

这篇关于具有“异常值:未安装_imaging C模块".在Mac OSX SL上与Buildout/Python/Django/PIL一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 05:45