标签:
python2.x及以下用的是PIL(图像处理库是 PIL(Python Image Library)),最新版本是 1.1.7 可在http://www.pythonware.com/products/pil/index.htm 下载和学习。
不过从该网站可看出它不支持python3.x
Pillow由PIL而来(支持3.x),所以该导入该库使用import PIL
由于本人用的是python 3.4 所以下载的Pillow
关于下载第三方库,有三种方法,之前用的都是
第一种方法
1 下载第三方包,解压
2 在命令提示符里输入cmd,然后用cd进入到第三方包的路径下
3 输入python setup.py build
4 输入python setup.py install
效率低下
故这次打算安装pip和easy_installer工具,通过代码就可以安装,
安装可参考:http://heipark.iteye.com/blog/1916758 或者http://blog.chinaunix.net/uid-12014716-id-3859827.html(内有官网地址)
除此之外在相应的官网也提供详细的安装教程(Mac OS的话真是快很多)
easy_installer简便安装:
For Windows without PowerShell 3 or for installation without a command-line, download ez_setup.py using your preferred web browser or other technique and “run” that file.
保存本地后运行就在安装了,
pip安装 法1:下载解压,cd切换到pip的目录,找到setup.py文件,然后输入python setup.py install
最后显示
Installed d:\python34\lib\site-packages\pip-7.1.2
Processing dependencies for pip==7.1.2
Finished processing dependencies for pip==7.1.2
法2(推荐):安装完easy_install 后就可以执行这样的命令了
C:\Users\Administrator>easy_install pip Searching for pip Best match: pip 7.1.2 Processing pip-7.1.2-py3.4.egg pip 7.1.2 is already the active version in easy-install.pth Installing pip-script.py script to D:\python34\Scripts Installing pip.exe script to D:\python34\Scripts Installing pip.exe.manifest script to D:\python34\Scripts Installing pip3-script.py script to D:\python34\Scripts Installing pip3.exe script to D:\python34\Scripts Installing pip3.exe.manifest script to D:\python34\Scripts Installing pip3.4-script.py script to D:\python34\Scripts Installing pip3.4.exe script to D:\python34\Scripts Installing pip3.4.exe.manifest script to D:\python34\Scripts Using d:\python34\lib\site-packages\pip-7.1.2-py3.4.egg Processing dependencies for pip Finished processing dependencies for pip
那么接下来就是pip的使用(可参考http://www.th7.cn/Program/Python/201410/289949.shtml)
C:\Users\Administrator>pip install Pillow Collecting Pillow Downloading Pillow-2.9.0-cp34-none-win32.whl (1.2MB) 100% |████████████████████████████████| Installing collected packages: Pillow Successfully installed Pillow-2.9.0
那么pillow就安装成功了
在Pillow的官网教程也有教程http://pillow.readthedocs.org/installation.html 多种安装方式可参考
接下来
C:\Users\Administrator>python Python 3.4.2 (v3.4.2:ab2c023a9 Type "help", "copyright", "cre >>> 2 2 >>> from PIL import Image >>>
没报错,说明安装成功
接下来可在http://pillow.readthedocs.org/index.html开始学习,或参考他人blog 后面将继续出图像处理的例子~
标签:
原文地址:http://www.cnblogs.com/france/p/4848778.html