国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

在Mac OS系統(tǒng)上安裝Python的Pillow庫的教程

2020-01-04 17:55:48
字體:
供稿:網(wǎng)友

這篇文章主要介紹了在MacOS下安裝Python的Pillow庫的教程,Pillow庫用來對(duì)圖片進(jìn)行各種處理操作,需要的朋友可以參考下

今天幫朋友做個(gè)python的小工具,發(fā)現(xiàn)系統(tǒng)上缺少ptyhon的支持庫,返回如下信息

ImportError: No module named PIL

然后就下載安裝,因?yàn)闄C(jī)器上也沒有python的管理工具pip,所以也一并安裝

1. 安裝pip

 

 
  1. sudo easy_install pip  

pip 安裝成功就可以直接安裝pil或者pillow

2. 通過命令pip install pil

 

 
  1. pip install Pil  

 

  1. Downloading/unpacking Pil  
  2. Could not find any downloads that satisfy the requirement Pil  
  3. Some externally hosted files were ignored (use --allow-external Pil to allow).  
  4. Cleaning up...  
  5. No distributions at all found for Pil  
  6. Storing debug log for failure in /Users/macbook/Library/Logs/pip.log  

3. 所以就安裝pillow
 

  1. pip install --use-wheel Pillow  
  1. Downloading/unpacking Pillow  
  2. Downloading Pillow-2.4.0.zip (6.5MB): 5.0MB downloaded  
  3. Cleaning up...  


弄了會(huì)別的回來發(fā)現(xiàn)還沒有下載完,這叫一個(gè)慢呀,于是放棄

4. Git

通過git下載源碼地址https://github.com/python-imaging/Pillow

 

 
  1. git clone https://github.com/python-imaging/Pillow.git  

然后開始編譯安裝

4.1

 

 
  1. python setup.py build_ext -i  

編譯完之后會(huì)提示運(yùn)行測試?yán)?,并且發(fā)現(xiàn)JPEG support not available

 

 
  1. --------------------------------------------------------------------  
  2. version Pillow 2.4.0  
  3. platform darwin 2.7.5 (default, Aug 25 2013, 00:04:04)  
  4. [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]  
  5. --------------------------------------------------------------------  
  6. --- TKINTER support available  
  7. *** JPEG support not available  
  8. *** OPENJPEG (JPEG2000) support not available  
  9. --- ZLIB (PNG/ZIP) support available  
  10. *** LIBTIFF support not available  
  11. --- FREETYPE2 support available  
  12. *** LITTLECMS2 support not available  
  13. *** WEBP support not available  
  14. *** WEBPMUX 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.  

4.2 因?yàn)镴PEG support not available,運(yùn)行python selftest.py報(bào)告錯(cuò)誤

1 tests of 57 failed.

于是只好卸載pillow

可以通過pip命令來卸載

 

 
  1. pip uninstall pillow  
  2. sudo pip uninstall pillow  

 

  1. Password:  
  2. Uninstalling Pillow:  
  3. /Library/Python/2.7/site-packages/Pillow-2.4.0-py2.7-macosx-10.9-intel.egg  
  4. /usr/local/bin/pilconvert.py  
  5. /usr/local/bin/pildriver.py  
  6. /usr/local/bin/pilfile.py  
  7. /usr/local/bin/pilfont.py  
  8. /usr/local/bin/pilprint.py  
  9. Proceed (y/n)? y<br> Successfully uninstalled Pillow <br>  

成功之后需要安裝libjpeg的支持

 

 
  1. brew install libjpeg  

安裝成功之后重新編譯pillow

 

 
  1. --------------------------------------------------------------------  
  2. version Pillow 2.4.0  
  3. platform darwin 2.7.5 (default, Aug 25 2013, 00:04:04)  
  4. [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]  
  5. --------------------------------------------------------------------  
  6. --- TKINTER support available  
  7. --- JPEG support available  
  8. *** OPENJPEG (JPEG2000) support not available  
  9. --- ZLIB (PNG/ZIP) support available  
  10. *** LIBTIFF support not available  
  11. --- FREETYPE2 support available  
  12. *** LITTLECMS2 support not available  
  13. *** WEBP support not available  
  14. *** WEBPMUX support not available  
  15. --------------------------------------------------------------------  
  16. python selftest.py  
  17.  
  18. --------------------------------------------------------------------  
  19. Pillow 2.4.0 TEST SUMMARY  
  20. --------------------------------------------------------------------  
  21. Python modules loaded from /Users/macbook/yyang/app-devel-source/python/Pillow/PIL  
  22. Binary modules loaded from /Users/macbook/yyang/app-devel-source/python/Pillow/PIL  
  23. --------------------------------------------------------------------  
  24. --- PIL CORE support ok  
  25. --- TKINTER support ok  
  26. --- JPEG support ok  
  27. *** JPEG 2000 support not installed  
  28. --- ZLIB (PNG/ZIP) support ok  
  29. *** LIBTIFF support not installed  
  30. --- FREETYPE2 support ok  
  31. *** LITTLECMS2 support not installed  
  32. *** WEBP support not installed  
  33. --------------------------------------------------------------------  
  34. Running selftest:  
  35. --- 57 tests passed.  

最后執(zhí)行安裝

 

 
  1. sudo python setup.py install 

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 抚顺县| 泸西县| 乌鲁木齐市| 合肥市| 高安市| 邵东县| 海原县| 新绛县| 上高县| 沙湾县| 那坡县| 衢州市| 新河县| 岳阳市| 马关县| 财经| 武平县| 白河县| 民县| 河池市| 泾川县| 澎湖县| 汾西县| 余姚市| 汪清县| 固安县| 横山县| 翁源县| 江西省| 禄丰县| 三河市| 玉林市| 建德市| 稻城县| 加查县| 泽州县| 常熟市| 汤原县| 泰来县| 德江县| 连州市|