开发者

How to fix "The _imaging C module is not installed" Django/WSGI/Apache

I run my test sites on my home computer which sadly uses Windows. Now, i'm trying to thumbnail an image but i'm getting the error:

The _imaging C module is not installed

But only when i try to access the view via the Apache server. Runserver thumbnails just fine. I've installed the special precomplied binaries that others have referenced, but haven't had any luck.

Any Idea why i开发者_如何学编程t works in runserver/shell but not Apache?


You need to have the path to PIL in and the other site-packages in your path in your .wsgi configuration file. So first you need to find the location of your site-packages (for example: /usr/local/lib/python2.6/site-packages/), then add it to your sys.path in your .wsgi file. Example WSGI:

import os, sys
sys.path.append('/home/www/sites/mysite', '/usr/local/lib/python2.6/site-packages/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()


I had the same problem under mod_wsgi on apache on windows server 2008. PIL would load from my virtualenv just fine, but would not load under mod_wsgi, even with the right version of msvcr90.dll in the folder with the .pyd files.

The answer for me has to do with WINDOWS SXS HELL and a patch that planders created.

I had to edit my distutils\msvc9compiler.py and comment out one line (I'm using Python 2.7, he was using 2.6.x), delete the build folder and rebuild PIL, and everything worked.

http://groups.google.com/group/isapi_wsgi-dev/browse_thread/thread/03fa2b485ec2281d?pli=1

I don't know who he is, but I am very grateful.


1.you should check _imaging.pyc or _imaging.dll or _imaging.so in you computer.

2.Exist!now, try to import Image

3.Right!try to import _imaging

if error, checking you computer is 32bit or 64bit.

if you computer is 32bit ,you should install some package like PIL-1.1.7.win32-py2.5 http://effbot.org/downloads/PIL-1.1.7.win32-py2.5.exe

if you computer is 64bit, you should install some package like PIL-1.1.7.win-amd64-py2.5 and you can found here:http://www.lfd.uci.edu/~gohlke/pythonlibs/

4.install the right package on site-packeges,it's will be running

GOOD LUCK!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜