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