當前位置:全科學識雲 > 生活範文 > 休閒雜談 > Mac OS系統上安裝Python的Pillow庫的教程
手機版

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

來源:全科學識雲 閱讀:3.09K 次

1. 安裝pip

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

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/

3. 所以就安裝pillow

pip install --use-wheel Pillow

Downloading/unpacking Pillow Downloading (6.5MB): 5.0MB downloaded Cleaning up...

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

4. Git

透過git下載源碼地址

git clone

然後開始編譯安裝

4.1

python 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 script. To check the build, run the script.

4.2 因爲JPEG support not available,執行python 報告錯誤

1 tests of 57 failed.

於是只好卸載pillow

可以透過pip命令來卸載

pip uninstall pillow sudo pip uninstall pillow

Password: Uninstalling Pillow: /Library/Python/2.7/site-packages/ /usr/local/bin/ /usr/local/bin/ /usr/local/bin/ /usr/local/bin/ /usr/local/bin/ Proceed (y/n)? y

成功之後需要安裝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 -------------------------------------------------------------------- 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 install

本文連結:https://www.qkxsy.com/shenghuofw/xiuxian/j5yevy.html

Copyright © 2024. 全科學識雲 All right reserved.

文字美圖素材,版權屬於原作者。部分文章內容由網友提供推送時因種種原因未能與原作者聯繫上,若涉及版權問題,敬請原作者聯繫我們,立即處理。