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

发布于 2024-08-18 12:58:30 字数 1659 浏览 5 评论 0原文

我正在将 Buildout 与 FeinCMS 一起用于我的 Django 项目。我在我的 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 上询问过,但绝对没有任何人提供任何帮助来了解这可能是什么。我在网上搜索了很多解决方案,但仍然没有找到有效的解决方案。它让我陷入困境,我一整天都被困在上面。有谁可能知道问题是什么?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

故人爱我别走 2024-08-25 12:58:30

我今天经历了同样的事情并找到了解决方案。问题是 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

它应该输出指向 libjpeg.8.dylib< 的行/code> 在你的构建目录中。

编辑:再想一想,使用 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

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文