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.10.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

  ----------------------------------------
  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.10.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11 /
usr/local/include/X11

再次执行:

pip install PIL --allow-external PIL --allow-unverified PIL

又报错误 :

    100% |████████████████████████████████| 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/31/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 211, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 311, in run
    root=options.root_path,
  File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 646, in install
    **kwargs
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 803, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 998, in move_wheel_files
    isolated=self.isolated,
  File "/Library/Python/2.7/site-packages/pip/wheel.py", line 339, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/Library/Python/2.7/site-packages/pip/wheel.py", line 317, in clobber
    shutil.copyfile(srcfile, destfile)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile
    with open(dst, ‘wb‘) as fdst:
IOError: [Errno 13] 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:90: 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.7
时间: 2024-08-09 02:05:03

MAC 下安装PIL的相关文章

Mac下安装PIL库

首先,下载jpegsrc.zlib.PIL python Imaging Library 1.1.7 Source Kit jpegsrc.v9a.tar.gz zlib-1.2.8.tar.gz 然后,解压上述库,顺带说下使用命令解压库 tar -zxvf zlib-1.2.8.tar.gz 1.安装jpeg 进入jpeg目录下 ./configure make sudo make install 2.安装zlib 进入zlib-1.2.7目录下 ./configure make sudo m

mac下安装mongoDB

方式一:命令行 MongoDB的安装有好多种安装方法,有普通青年的HomeBrew方式,也有文艺青年的源码编译方式.我只想快速的装起来用一下,所以我选最简单的HomeBrew. 请参考官方文档 : http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/ 更新Homebrew的package数据库,在Mac的终端中输入: $ brew update 然后耐心等待,这个没有任何显示,估计要几分钟,取决于网络的速度.然后就列出了

mac下安装配置java开发环境

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Helvetica; color: #000000 } p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Helvetica; color: #000000; min-height: 13.0px } p.p3 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #

Mac下安装LNMP(Nginx+PHP5.6)环境

Mac下安装LNMP(Nginx+PHP5.6)环境 安装Homebrew 最近工作环境切换到Mac,所以以OS X Yosemite(10.10.1)为例,记录一下从零开始安装Mac下LNMP环境的过程 确保系统已经安装xcode,然后使用一行命令安装依赖管理工具Homebrew ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 之后就可以使用 brew

MAC 下安装 SVN

在mac下安装svn走了很多弯路,进过探索,现在对svn的安装做了总结,可以分为2种: 1.由于 xCode自带svn,所以可以安装xCode 1).打开App Store,搜索xCode,下载安装 打开 Launchpad>其他>终端,输入 svn --version 即可查看svn 版本 2.使用HomeBrew来安装SubVersions 1).安装HomeBrew /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercon

Mac下安装 MongoDB

Mac 下安装 MongoDB 一般有两种方法,一种是通过源码安装,一种是直接使用 homebrew ,个人推荐使用 homebrew ,简单粗暴. 1.安装 homebrew : /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 2.使用 homebrew 安装 MongoDB : brew install mongodb 喝杯茶的功夫就

MAC下安装Brew[转]

MAC下安装Brew 1.安装XCode xcode-select --install 2.安装HomeBrew ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 3.检查homebrew是否有冲突等 brew doctor 4.更新Brew sudo brew updatesudo brew upgrade 5.添加其它的源 brew tap homebr

在mac下安装了MySqL + MySQLWorkbench + PyCharm

今天在mac下安装了MySqL  +   MySQLWorkbench + PyCharm 安装这些东西没有在windows下熟悉. 在Mac下安装程序真的不是很适应,感觉很不爽!!!安装完成后还是蛮高兴,后面可以做自己要做的事情了. 通过查阅各种各样的资料,去安装这些东东.最后经过一番周折终于安装完成.下面是对安装过程和遇到的问题做个简单记录. 一.下载MySQL和MySQL Workbench http://dev.mysql.com/downloads/mysql/ 选择合适自己Mac 版

Ubuntu下安装PIL

Ubuntu下安装PIL 1)sudo apt-get install libjpeg-dev 2)sudo apt-get install libfreetype6-dev 3)sudo easy_install PIL 不安装libjpeg-dev,会出现:"decoder jpeg not available"错误,如下图示. 不安装libfreetype6-dev,会出现“The _imagingft C module is not installed”错误,如下图示: -*-