I want to be able to use the PIL library on a web hosting machine. The machine has Python 2.4.3 installed, but not the PIL library. I tried downloadin开发者_开发百科g the PIL source and putting the PIL folder into my directory. It kind of works, except when I need to do some actual image processing, which brings up an ImportError
, saying that "The _imaging C module is not installed". Googling this, it seems like I would need to throw an _imaging.so file into the PIL folder, but I couldn't find a precompiled one online.
At this point, I'm not sure if I'm even on the right track. What should I do from here? Any help is appreciated.
Thanks.
You need to compile that module. Running the setup.py install
command should do it for you, provided the host has a working compiler and the required libraries. You can use virtualenv to have it installed somewhere where you have rights to put files (by default it would try to install it system-wide).
If it doesn't have a working compiler and right libraries and header files, then you need to either compile it on another computer with the same architecture and copy it, or find the packages for whatever operating system your host is running and extract the right files from them.
By the way, just asking them to install PIL could work too!
I know this isn't a programmatic answer but ... you should switch webhosts.
There is no good reason to be using Python 2.4 and dealing with old stuff when so many problems have been fixed already. I recommend WebFaction but any host running a modern OS/Python installation is fine (Ubuntu is really the easiest at this point).
精彩评论