python的pillow下載
A. 怎樣安裝python的圖像處理庫pillow
找到easy_install.exe工具。在windows下安裝Python後,在其安裝路徑下的scripts文件中默認安裝好了easy_install工具。完整路徑如下例:D:\Python27\Scripts\easy_install.exe;其中為我python的安裝路徑,大家可以根據自己的安裝路徑更改。
使用easy_install.exe工具一鍵安裝pip.打開cmd,輸入安裝命令。操作命令如下圖所示:
pip安裝成功後,在cmd下執行pip,將會有如下提示。
再通過pip進行一鍵安裝Pillow。pip類似RedHat裡面的yum,安裝Python包非常方便。操作命令如下圖所示:
5
到這一步就安裝好了。馬上用起來吧,下圖是用這個庫將圖片轉換的字元畫。轉換後有點大,分割成兩張了。
B. python3.4怎麼安裝pil
目前沒有與python3.x 對應版本的PIL, 所以python3.x 一般用Pillow
C. 安裝python3.5的pillow需要protobuf>=3。在Windows系統下怎麼安裝
首先從google上下載protobuf-2.5.0.zip和protoc-2.5.0-win32.zip,然後把protoc-2.5.0-win32.zip里的protoc.exe放到protobuf-2.5.0\src\下。
切換到protobuf-2.5.0\python
執行指令 python setup.py build, python setup.py test, python setup.py install
D. python pil 怎麼安裝
關於Pillow與PIL
PIL(Python Imaging Library)是Python一個強大方便的圖像處理庫,名氣也比較大。不過只支持到Python 2.7。
PIL官方網站:http://www.pythonware.com/procts/pil/
Pillow是PIL的一個派生分支,但如今已經發展成為比PIL本身更具活力的圖像處理庫。目前最新版本是3.0.0。
Pillow的Github主頁:https://github.com/python-pillow/Pillow
Pillow的文檔(對應版本v3.0.0):https://pillow.readthedocs.org/en/latest/handbook/index.html
Pillow的文檔中文翻譯(對應版本v2.4.0):http://pillow-cn.readthedocs.org/en/latest/
Python 3.x 安裝Pillow
給Python安裝Pillow非常簡單,使用pip或easy_install只要一行代碼即可。
在命令行使用PIP安裝:
pip install Pillow
或在命令行使用easy_install安裝:
easy_install Pillow
安裝完成後,使用from PIL import Image就引用使用庫了。比如:
from PIL import Image
im = Image.open("bride.jpg")
im.rotate(45).show()
E. python如何安裝pil庫
PIL:Python Imaging Library,已經是Python平台事實上的圖像處理標准庫了。
由於PIL僅支持到Python 2.7,加上年久失修,於是一群志願者在PIL的基礎上創建了兼容的版本,名字叫Pillow,支持最新Python 3.x,又加入了許多新特性,因此,我們可以直接安裝使用Pillow。
安裝Python時已經把pip3也備好了,可以直接使用pip3安裝PIL
命令行:pip3 install pillow
注意:
1.PIL安裝包名字的pillow
2.使用pip3命令時,是要在pip3.exe所在路徑下才能執行。一般pip3.exe是在python安裝目錄下的Script文件夾中。
更多Python相關技術文章,請訪問Python教程欄目進行學習!以上就是小編分享的關於python如何安裝pil庫的詳細內容希望對大家有所幫助,更多有關python教程請關注環球青藤其它相關文章!
F. python3 pillow有哪些功能
安裝剛接觸Pillow的朋友先來看一下Pillow的安裝方法,在這里我們以Mac OS環境為例: (1)、使用 pip 安裝 Python 庫。pip 是 Python 的包管理工具,安裝後就可以直接在命令行一站式地安裝/管理各種庫了(pip 文檔)。
$ wget
tar xzf pip-0.7.2.tar.gz$ cd pip-0.7.2$ python setup.py install
(2)、使用 pip 下載獲取 Pillow:
$ pip install pillow
(3)、安裝過程中命令行出現錯誤提示:」error: command 『clang' failed with exit status
1」。上網查閱,發現需要通過 Xcode 更新 Command Line Tool。於是打開
Xcode->Preferences->Downloads-Components選項卡。咦?竟然沒了 Command Line
Tools。再查,發現 Xcode 5 以上現在需要用命令行安裝:
$ xcode-select —install
系統會彈出安裝命令行工具的提示,點擊安裝即可。
此時再 pip install pillow,就安裝成功了。
pip freeze 命令查看已經安裝的 Python 包,Pillow 已經乖乖躺那兒了。
好了,下面開始進入教程~
Image類
Pillow中最重要的類就是Image,該類存在於同名的模塊中。可以通過以下幾種方式實例化:從文件中讀取圖片,處理其他圖片得到,或者直接創建一個圖片。
使用Image模塊中的open函數打開一張圖片:
>>> from PIL import Image>>> im = Image.open("lena.ppm")
如果打開成功,返回一個Image對象,可以通過對象屬性檢查文件內容
G. python 怎麼安裝pillow
1. 安裝pip
[plain] view plain
sudo easy_install pip
pip 安裝成功就可以直接安裝pil或者pillow
2. 通過命令pip install pil
[plain] view plain
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
[plain] view plain
pip install --use-wheel Pillow
Downloading/unpacking Pillow
Downloading Pillow-2.4.0.zip (6.5MB): 5.0MB downloaded
Cleaning up...
弄了會別的回來發現還沒有下載完,這叫一個慢呀,於是放棄
4. 通過Git下載源碼地址https://github.com/python-imaging/Pillow
[plain] view plain
git clone https://github.com/python-imaging/Pillow.git
然後開始編譯安裝
4.1
[plain] view plain
python setup.py build_ext -i
編譯完之後會提示運行測試例子,並且發現JPEG support not available
[plain] view plain
--------------------------------------------------------------------
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報告錯誤
[plain] view plain
1 tests of 57 failed.
於是只好卸載pillow
可以通過pip命令來卸載
[plain] view plain
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的支持
[plain] view plain
brew install libjpeg
安裝成功之後重新編譯pillow
[plain] view plain
--------------------------------------------------------------------
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
--------------------------------------------------------------------
[plain] view plain
python selftest.py
[plain] view plain
--------------------------------------------------------------------
Pillow 2.4.0 TEST SUMMARY
--------------------------------------------------------------------
Python moles loaded from /Users/macbook/yyang/app-devel-source/python/Pillow/PIL
Binary moles 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.
最後執行安裝
[plain] view plain
sudo python setup.py install