使用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.
相關文章
相關標籤/搜索