Having “Exception Value: The _imaging C module is not installed” with my Buildout/Python/Django/PIL on Mac OSX SL?

心不动则不痛 提交于 2019-12-24 02:56:14

问题


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.

My traceback is here: http://dpaste.com/149492/

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}

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?


回答1:


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

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

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

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

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.



来源:https://stackoverflow.com/questions/2124306/having-exception-value-the-imaging-c-module-is-not-installed-with-my-buildou

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!