MAC 下安装PIL
1. 安装使用
pip install pil
结果报如下错误
Collecting PIL
Could not find a version that satisfies the requirement PIL (from versions: )
Some externally hosted files were ignored as access to them may be unreliable (use --allow-external PIL to allow).
No matching distribution found for PIL
2.
This is due to changes in the new version of Pip. Run pip --version
and I'm willing to bet you are running 1.5. See the changelog here. This new default behavior enhances security. In PIL's case, the file you are installing actually comes from effbot.org (thus --allow-external
) and PyPi doesn't have a checksum to guarantee validity (thus --allow-unverified
).
Also, you might consider using the Pillow replacement to PIL.
pip install PIL --allow-external PIL --allow-unverified PIL
报如下错误 :
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10..sdk/usr/include/tk.h::: fatal error: 'X11/Xlib.h' file not found
# include <X11/Xlib.h>
^
error generated.
error: command 'cc' failed with exit status ----------------------------------------
Failed building wheel for PIL
Failed to build PIL
3.
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.pl
atform/Developer/SDKs/MacOSX10..sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11 /
usr/local/include/X11
再次执行:
pip install PIL --allow-external PIL --allow-unverified PIL
又报错误 :
% |████████████████████████████████| 507kB 97kB/s
Building wheels for collected packages: PIL
Running setup.py bdist_wheel for PIL
Stored in directory: /Users/zhangxin/Library/Caches/pip/wheels/ba//4a/9a5596f0640c9099a4302a71b56b7581e16e0d0b5a8f30ce3e
Successfully built PIL
Installing collected packages: PIL
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line , in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line , in run
root=options.root_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line , in install
**kwargs
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line , in install
self.move_wheel_files(self.source_dir, root=root)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line , in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip/wheel.py", line , in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip/wheel.py", line , in clobber
shutil.copyfile(srcfile, destfile)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line , in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno ] Permission denied: '/Library/Python/2.7/site-packages/PIL.pth'
这次是忘了加sudo,加上就OK了。
localhost:newlabel zhangxin$ sudo pip install PIL --allow-external PIL --allow-unverified PIL
Password:
The directory '/Users/zhangxin/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/zhangxin/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting PIL
/Library/Python/2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
PIL is potentially insecure and unverifiable.
Installing collected packages: PIL
Successfully installed PIL-1.1.
4. 在使用ImageFont.truetype(fontname, 36)时又出现错误:
Traceback (most recent call last):
File "generate.py", line , in <module>
font = ImageFont.truetype(fontname, )
File "/Library/Python/2.7/site-packages/PIL/ImageFont.py", line , in truetype
return FreeTypeFont(filename, size, index, encoding)
File "/Library/Python/2.7/site-packages/PIL/ImageFont.py", line , in __init__
self.font = core.getfont(file, size, index, encoding)
File "/Library/Python/2.7/site-packages/PIL/ImageFont.py", line , in __getattr__
raise ImportError("The _imagingft C module is not installed")
ImportError: The _imagingft C module is not installed
5. 后来,我改变主意了,我卸载了pil,我安装pillow。
sudo pip install pillow
然后成功了。叫我神经病吧
MAC 下安装PIL的更多相关文章
- Mac下安装 PIL
最近入手MacBook Pro 在配置PIL环境的时候遇到一些问题.现在把解决方式记录下来,希望对有需要的有所帮助. 1. 安装brew : brew 又叫Homebrew,是Mac OSX上的软件 ...
- Mac 下安装Jenkins
Mac 下安装Jenkins 开始 Jenkins是一个基于Java开发的一种持续集成工具,用于建工持续重复的工作,功能包括: 持续的软件版本发布/测试项目 监控外部调用执行的工作. 近期打算搭建自动 ...
- MAC下安装与配置MySQL
MAC下安装与配置MySQL MAC下安装与配置MySQL 一 下载MySQL 访问MySQL的官网http://www.mysql.com/downloads/ 然后在页面中会看到“MySQL ...
- Mac下安装UPnP Inspector
由于工作中需要用到UPnP Inspector这个工具,而这个工具在windows下安装非常简单,在Mac下安装却很麻烦,在此记录安装流程. 这个工具依赖于两个其他的库:Coherence(一个DLN ...
- Mac下安装Wireshark,双击闪退
Mac OS X上使用Wireshark抓包(http://blog.csdn.net/phunxm/article/details/38590561) Mac下安装Wireshark /Appli ...
- Mac下安装zshell
Mac 下安装zshell 什么是shell 大多数命令行用户接触最多的是Bash,因为Bash是各个版本操作系统(Linux&Mac)的默认shell. 查看当前使用的shell $ ech ...
- 【高可用HA】Apache (1) —— Mac下安装Apache Httpd到自定义路径(非/etc/apache2)
Mac下安装Apache Httpd httpd版本: httpd-2.4.17 参考来源: Tomcat Clustering - A Step By Step Guide Apache HTTP ...
- 《OD大数据实战》mac下安装nginx+php
一.mac安装nginx + php + php-fpm 或apache + php 1. Mac 下 Nginx.MySQL.PHP-FPM 的安装配置 2. Mac下安装LNMP(Nginx+P ...
- Mac下安装HBase及详解
Mac下安装HBase及详解 1. 千篇一律的HBase简介 HBase是Hadoop的数据库, 而Hive数据库的管理工具, HBase具有分布式, 可扩展及面向列存储的特点(基于谷歌BigTabl ...
随机推荐
- C#事件作用和用法
例如有下面的需求需要实现:程序主画面中弹出一个子窗口.此时主画面仍然可以接收用户的操作(子窗口是非模态的).子窗口上进行某些操作,根据操作的结果要在主画面上显示不同的数据. 即如下图所示: 大多数我们 ...
- css设置文字不换行,超过的部分用“...”代替
设置文字不换行,超过的部分用“...”代替 overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: /*so ...
- MySQL在远程访问时非常慢的解决skip-name-resolve 并且出现 Reading from net
转载:http://www.itokit.com/2012/0515/73932.html 服务器放在局域网内进行测试时,数据库的访问速度还是很快.但当服务器放到外网后,数据库的访问速度就变得非常慢. ...
- android中listview的item滑动删除效果(已解决listview点击问题)
领导看到iphone上tableview有个滑动删除的效果,要求在android上也实现,搜了下资料,实现起来比较简单,可弄到后面,居然不能点击了,把一篇文章中的代码修改了一下,捣鼓了一番,搞定,下面 ...
- hdu-A+B问题,大数加法
格式问题很头疼啊 Input The first line of the input contains an integer T(1<=T<=20) which means the num ...
- C语言小结之链表
链表的学习 在数据结构中有一种结构叫做线性表,线性表是储存一个线性数据的表格,本文就简要的介绍一下线性表的构成. 一.线性表的定义定义:由同种类型数据元素构成的有序数列的线性结构长度.表头.表尾Lis ...
- 贴板子系列_1-km算法,匈牙利算法
KM算法 #include <bits/stdc++.h> #define N 1500 #define inf 999999999 using namespace std; ,ny=,k ...
- handoff了解
iOS8推出一个新特性,叫做Handoff.Handoff中文含义为换手(把接力棒传给下一个人),可以在一台Mac和iOS设备上开始工作,中途将工作交换到另一个Mac或iOS设备中进行.这个在iOS8 ...
- 定位 - CoreLocation - INTULocationManager
https://github.com/intuit/LocationManager #import "ViewController.h" #import "INTULoc ...
- 结缘PDO
起因 一直没有注意看数据库相关知识 几个月之前,无意打开如下一段代码: 被人吐槽是N年前的写法.后来也是学习需要,单一mysql已经不合适了.于是上网搜了一下好方法,PDO迎面而来. 诱惑 上网浏览时 ...