Python PIL : import _imaging _imagingft : No module named _imaging _imagingft(转)
今天在部署一Python应用时,安装了PIL,却无法导致_imaging 、_imagingft库。 这是由于PIL中使用到的一些库未安装,解决方法如下: # import _imaging : No module named _imaging
# 需要先安装jpeg库 wget http://www.ijg.org/files/jpegsrc.v7.tar.gz tar -zxvf jpegsrc.v7.tar.gz cd jpeg-7 CC="gcc -arch x86_64" ./configure --enable-shared --enable-static make make install # 然后再安装PIL库 wget http://effbot.org/downloads/Imaging-1.1.6.tar.gz tar -zxvf Imaging-1.1.6.tar.gz cd Imaging-1.1.6 rm -rf build # 设置JPEG库的路径 vim setup.py : JPEG_ROOT = libinclude("/usr/local") python2.5 setup.py build python2.5 setup.py install # 把JPEG加入到系统库路径 echo '/usr/local/lib' >> /etc/ld.so.conf ldconfig # OK,完成 上述操作完成后就不会再报找不到 _imaging 的错误了。 别高兴太高,如果用到了freetype2,还会报_imagingft找不到。解决办法类似,先安装freetype2,在安装PIL里指定freetype2路径,将freetype2加到系统库路径中即可。 |