使用django + Pillow进行图片上传压缩格式保存时出错的处理

安装Pillow以前先安装好python-dev libzip-dev libjpeg8-dev libfreetype6-dev libpng12-dev 不然在用PIL(Pillow)进行上传图片压缩格式保存时会出错: encoder jpeg not available decoder zip not available 在此输入图片描述python

sudo apt-get install python-dev libzip-dev libjpeg8-dev libfreetype6-dev libpng12-dev pip uninstall Pillow pip install Pillow 安装好后的报告以下:linux

--------------------------------------------------------------------
PIL SETUP SUMMARY
--------------------------------------------------------------------
version Pillow 2.6.1
platform linux2 2.7.6 (default, Mar 22 2014, 22:59:38)
[GCC 4.8.2]
--------------------------------------------------------------------
*** TKINTER support not available
--- JPEG support available
*** OPENJPEG (JPEG2000) support not available
--- ZLIB (PNG/ZIP) support available
*** LIBTIFF support not available
--- FREETYPE2 support available
*** LITTLECMS2 support not available
*** WEBP support not available
*** WEBPMUX support not available
--------------------------------------------------------------------

若是想更多的支持时(webp libtiff) sudo apt-get install python-dev libzip-dev libjpeg8-dev libfreetype6-dev libpng12-dev libtiff5-dev libwebp-devweb

pip uninstall Pillowui

pip install Pillowcode

.........orm

--------------------------------------------------------------------
PIL SETUP SUMMARY
--------------------------------------------------------------------
version      Pillow 2.7.0
platform     linux2 2.7.6 (default, Mar 22 2014, 22:59:56)
             [GCC 4.8.2]
--------------------------------------------------------------------
*** TKINTER support not available
--- JPEG support available
*** OPENJPEG (JPEG2000) support not available
--- ZLIB (PNG/ZIP) support available
--- LIBTIFF support available
--- FREETYPE2 support available
*** LITTLECMS2 support not available
--- WEBP support available
--- WEBPMUX support available
--------------------------------------------------------------------
To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the
setup.py script.
相关文章
相关标签/搜索