欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

 更新時(shí)間:2015年11月20日 15:02:08   作者:bulreed  
這篇文章主要介紹了在MacOS下安裝Python的Pillow庫(kù)的教程,Pillow庫(kù)用來(lái)對(duì)圖片進(jìn)行各種處理操作,需要的朋友可以參考下

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

ImportError: No module named PIL 
然后就下載安裝,因?yàn)闄C(jī)器上也沒(méi)有python的管理工具pip,所以也一并安裝
1. 安裝pip

sudo easy_install pip 

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


2. 通過(guò)命令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... 

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

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

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

然后開(kāi)始編譯安裝

4.1

python setup.py build_ext -i 

編譯完之后會(huì)提示運(yùn)行測(cè)試?yán)?,并且發(fā)現(xiàn)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 因?yàn)镴PEG support not available,運(yùn)行python selftest.py報(bào)告錯(cuò)誤


1 tests of 57 failed. 

于是只好卸載pillow

可以通過(guò)pip命令來(lái)卸載

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. 

最后執(zhí)行安裝

sudo python setup.py install 

相關(guān)文章

  • pd.DataFrame統(tǒng)計(jì)各列數(shù)值多少的實(shí)例

    pd.DataFrame統(tǒng)計(jì)各列數(shù)值多少的實(shí)例

    今天小編就為大家分享一篇pd.DataFrame統(tǒng)計(jì)各列數(shù)值多少的實(shí)例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2019-12-12
  • Python模擬登錄之滑塊驗(yàn)證碼的破解(實(shí)例代碼)

    Python模擬登錄之滑塊驗(yàn)證碼的破解(實(shí)例代碼)

    這篇文章主要介紹了Python模擬登錄之滑塊驗(yàn)證碼的破解(實(shí)例代碼),代碼簡(jiǎn)單易懂,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-11-11
  • 通過(guò)LyScript實(shí)現(xiàn)從文本中讀寫(xiě)ShellCode

    通過(guò)LyScript實(shí)現(xiàn)從文本中讀寫(xiě)ShellCode

    LyScript 插件通過(guò)配合內(nèi)存讀寫(xiě),可實(shí)現(xiàn)對(duì)特定位置的ShellCode代碼的導(dǎo)出。本文將利用這一特性實(shí)現(xiàn)從文本中讀寫(xiě)ShellCode,感興趣的可以了解一下
    2022-08-08
  • Python OpenCV讀取顯示視頻的方法示例

    Python OpenCV讀取顯示視頻的方法示例

    這篇文章主要介紹了 Python OpenCV讀取顯示視頻的方法示例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-02-02
  • Python中字符串切片詳解

    Python中字符串切片詳解

    這篇文章主要介紹了Python中字符串切片,在python中定義個(gè)字符串然后把它賦值給一個(gè)變量。我們可以通過(guò)下標(biāo)訪問(wèn)單個(gè)的字符,跟所有的語(yǔ)言一樣,下標(biāo)從0開(kāi)始。這時(shí)我們可以通過(guò)切片方式來(lái)截取出我們定義的字符串的一部分,下面小編將為大家詳細(xì)介紹,需要的朋友可以參考下
    2021-10-10
  • Matlab中的mat數(shù)據(jù)轉(zhuǎn)成python中使用的npy數(shù)據(jù)遇到的坑及解決

    Matlab中的mat數(shù)據(jù)轉(zhuǎn)成python中使用的npy數(shù)據(jù)遇到的坑及解決

    這篇文章主要介紹了Matlab中的mat數(shù)據(jù)轉(zhuǎn)成python中使用的npy數(shù)據(jù)遇到的坑及解決,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-12-12
  • 在python中路徑含有空格的問(wèn)題及解決

    在python中路徑含有空格的問(wèn)題及解決

    這篇文章主要介紹了在python中路徑含有空格的問(wèn)題及解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-02-02
  • Python工程師面試題 與Python基礎(chǔ)語(yǔ)法相關(guān)

    Python工程師面試題 與Python基礎(chǔ)語(yǔ)法相關(guān)

    這篇文章主要為大家分享了Python工程師面試題,面試題的內(nèi)容主要與Python基礎(chǔ)語(yǔ)法相關(guān),感興趣的小伙伴們可以參考一下
    2016-01-01
  • PyTorch?使用torchvision進(jìn)行圖片數(shù)據(jù)增廣

    PyTorch?使用torchvision進(jìn)行圖片數(shù)據(jù)增廣

    本文主要介紹了PyTorch?使用torchvision進(jìn)行圖片數(shù)據(jù)增廣,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2022-05-05
  • 詳解python 模擬豆瓣登錄(豆瓣6.0)

    詳解python 模擬豆瓣登錄(豆瓣6.0)

    這篇文章主要介紹了python模擬豆瓣登錄,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-04-04

最新評(píng)論