64位centos下安裝python的PIL模塊


由於處理圖片需要用到PIL模塊,具體的安裝步驟如下:

1. 安裝PIL所需的系統庫

1 yum install zlib zlib-devel 
2 yum install libjpeg libjpeg-level
3 yum install freetype freetype-devel

 

2. 使用PIP安裝PIL模塊

1 pip install PIL

 

3.安裝

 1 python setup.py build_ext -i 
2 running build_ext
3 --------------------------------------------------------------------
4 PIL 1.1.7 SETUP SUMMARY
5 --------------------------------------------------------------------
6 version 1.1.7
7 platform linux2 2.6.7 (r267:88850, Mar 19 2012, 00:13:26)
8 [GCC 4.1.2 20080704 (Red Hat 4.1.2-51)]
9 --------------------------------------------------------------------
10 *** TKINTER support not available
11 --- JPEG support available
12 --- ZLIB (PNG/ZIP) support available
13 --- FREETYPE2 support available
14 *** LITTLECMS support not available
15 --------------------------------------------------------------------
16 To add a missing option, make sure you have the required
17 library, and set the corresponding ROOT variable in the
18 setup.py script.
19
20 To check the build, run the selftest.py script.

 

3.依然有兩個報錯,不過不影響使用

 

 

 

另外:安裝完成后提示以下錯誤:

  1. *** TKINTER support not installed
  2. *** JPEG support not installed
  3. *** ZLIB (PNG/ZIP) support not installed
  4. *** FREETYPE2 support not installed
  5. *** LITTLECMS support not installed

或下面的錯誤:

  1. IOError: decoder jpeg not available

可以用如下方案:

修改PIL的安裝配置文件,因此不能通過PIP安裝,而需要下載代碼包進行安裝:

  1. wget http://effbot.org/downloads/Imaging-1.1.7.tar.gz
  2. tar xvfz Imaging-1.1.7.tar.gz
  3. python setup.py build_ext -i
  4. 修改setup.py:
  5. TCL_ROOT = "/usr/lib64/"
  6. JPEG_ROOT = "/usr/lib64/"
  7. ZLIB_ROOT = "/usr/lib64/"
  8. TIFF_ROOT = "/usr/lib64/"
  9. FREETYPE_ROOT = "/usr/lib64/"
  10. LCMS_ROOT = "/usr/lib64/"
  11. python setup.py

默認TCL_ROOT的設置為NONE,因此傳到系統庫的路徑。python setup.py build_ext -i是用來進行安裝前的檢查。
按照以上步驟安裝正常了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM