运行项目程序的时候出现这种错误:
Traceback (most recent call last): File "G:\workspace\ImageTest\image\ImageTest.py", line 16, in <module> Lim = im.convert("L") File "E:\Python27\lib\site-packages\PIL\Image.py", line 679, in convert self.load() File "E:\Python27\lib\site-packages\PIL\ImageFile.py", line 164, in load self.load_prepare() File "E:\Python27\lib\site-packages\PIL\ImageFile.py", line 231, in load_prepare self.im = Image.core.new(self.mode, self.size) File "E:\Python27\lib\site-packages\PIL\Image.py", line 37, in __getattr__ raise ImportError("The _imaging C module is not installed") ImportError: The _imaging C module is not installed
wget http://effbot.org/downloads/Imaging-1.1.7.tar.gz [python123]# tar xvf Imaging-1.1.7.tar.gz [python123]# cd Imaging-1.1.7 [python123]# python setup.py install
_imaging.c:75:20: fatal error: Python.h: No such file or directory
找到这篇帖子:http://hi.baidu.com/tysonabc/item/8f4cd13823c77f99b90c0310
安装apt-get install python-dev
即可
最头疼这些包与包之间的依赖了。
发现还是不行,出现这种错误:
File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 679, in convert self.load() File "/usr/local/lib/python2.7/dist-packages/PIL/ImageFile.py", line 189, in load d = Image._getdecoder(self.mode, d, a, self.decoderconfig) File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 385, in _getdecoder raise IOError("decoder %s not available" % decoder_name) IOError: decoder jpeg not available
故而以上所述所做所为皆为白费。
重新来过
http://blog.sina.com.cn/s/blog_5d76edd801018bwn.html
http://hi.baidu.com/litto/item/9e1169cdd754e925e90f2ea2
在这两篇帖子的帮助下才最终折腾完了,
ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib
ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib
ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib
ldconfig