mac os下安装Python Image Library (PIL)

来源:互联网 发布:软件测试搭建环境 编辑:程序博客网 时间:2024/05/16 19:41

1、首先需要到 http://www.pythonware.com/products/pil/ 下载PIL包

2、解压tar xvf PIL-1-1.7.tar

3、进入python setup.py install

如果你安装成功了那么恭喜你,如果有错误如下

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/tk.h:78:11: fatal error: 'X11/Xlib.h' file not found#      include <X11/Xlib.h>               ^1 error generated.error: command 'cc' failed with exit status 1
那么请继续往下看

4、

在终端下 输入一下命令,如果出现permission denied那么需要解锁,在终端下输入sudo -s之后再执行以下命令

ln -s  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11 /usr/local/include/X11 
sudo pip install pil
就这样你应该会看到successfully 安装成功了
5、如果需要在PyCharm上开发,还需要添加PIL包,在PyCharm --> Preference --> Project Interpreter --> + --> 搜索PIL --> Install Package
搞定,可以使用PIL了 
另附上一个PIL使用教程
http://www.doc88.com/p-5905990309177.html

0 0
原创粉丝点击