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

首頁 > 編程 > Python > 正文

在Mac OS系統上安裝Python的Pillow庫的教程

2019-11-25 17:01:31
字體:
來源:轉載
供稿:網友

今天幫朋友做個python的小工具,發現系統上缺少ptyhon的支持庫,返回如下信息

ImportError: No module named PIL 
然后就下載安裝,因為機器上也沒有python的管理工具pip,所以也一并安裝
1. 安裝pip

sudo easy_install pip 

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


2. 通過命令pip install pil

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

3. 所以就安裝pillow

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

弄了會別的回來發現還沒有下載完,這叫一個慢呀,于是放棄
4. Git

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

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

然后開始編譯安裝

4.1

python setup.py build_ext -i 

編譯完之后會提示運行測試例子,并且發現JPEG support not available

-------------------------------------------------------------------- version   Pillow 2.4.0 platform   darwin 2.7.5 (default, Aug 25 2013, 00:04:04)        [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] -------------------------------------------------------------------- --- TKINTER support available *** JPEG support not 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 -------------------------------------------------------------------- To add a missing option, make sure you have the required library, and set the corresponding ROOT variable in the setup.py script.  To check the build, run the selftest.py script. 

4.2 因為JPEG support not available,運行python selftest.py報告錯誤


1 tests of 57 failed. 

于是只好卸載pillow

可以通過pip命令來卸載

pip uninstall pillow sudo pip uninstall pillow 
Password: Uninstalling Pillow:  /Library/Python/2.7/site-packages/Pillow-2.4.0-py2.7-macosx-10.9-intel.egg  /usr/local/bin/pilconvert.py  /usr/local/bin/pildriver.py  /usr/local/bin/pilfile.py  /usr/local/bin/pilfont.py  /usr/local/bin/pilprint.py Proceed (y/n)? y  
  Successfully uninstalled Pillow 

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

brew install libjpeg 

安裝成功之后重新編譯pillow

-------------------------------------------------------------------- version   Pillow 2.4.0 platform   darwin 2.7.5 (default, Aug 25 2013, 00:04:04)        [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] -------------------------------------------------------------------- --- TKINTER support 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 -------------------------------------------------------------------- python selftest.py  -------------------------------------------------------------------- Pillow 2.4.0 TEST SUMMARY  -------------------------------------------------------------------- Python modules loaded from /Users/macbook/yyang/app-devel-source/python/Pillow/PIL Binary modules loaded from /Users/macbook/yyang/app-devel-source/python/Pillow/PIL -------------------------------------------------------------------- --- PIL CORE support ok --- TKINTER support ok --- JPEG support ok *** JPEG 2000 support not installed --- ZLIB (PNG/ZIP) support ok *** LIBTIFF support not installed --- FREETYPE2 support ok *** LITTLECMS2 support not installed *** WEBP support not installed -------------------------------------------------------------------- Running selftest: --- 57 tests passed. 

最后執行安裝

sudo python setup.py install 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 友谊县| 舞阳县| 嵊泗县| 仙桃市| 延安市| 洛阳市| 太和县| 明溪县| 乌兰察布市| 克东县| 仁化县| 厦门市| 丹凤县| 北宁市| 雷州市| 黄平县| 民和| 友谊县| 沈阳市| 德清县| 察哈| 静乐县| 青浦区| 胶州市| 五河县| 平罗县| 湟中县| 弥渡县| 佛山市| 隆化县| 米脂县| 平南县| 柳河县| 米易县| 白山市| 崇义县| 项城市| 榕江县| 金乡县| 东安县| 资兴市|