我无法在Osx中安装"pip install pil" [英] I can't install 'pip install pil' in Osx

查看:111
本文介绍了我无法在Osx中安装"pip install pil"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已安装Xcode,python + django已启动并正常运行.

Xcode is installed, python+django is up and running smoothly.

我正在编写跑步":

pip install PIL

响应:

Downloading/unpacking PIL
  Running setup.py egg_info for package PIL
    WARNING: '' not a valid package name; please use only.-separated package names in setup.py

Installing collected packages: PIL
  Running setup.py install for PIL
    WARNING: '' not a valid package name; please use only.-separated package names in setup.py
    --- using frameworks at /System/Library/Frameworks
    building '_imaging' extension
    clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -IlibImaging -I/System/Library/Frameworks/Python.framework/Versions/2.7/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.8-intel-2.7/_imaging.o
    unable to execute clang: No such file or directory
    error: command 'clang' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/var/folders/3_/tp_3vp9966dc65phynpzl04h0000gn/T/pip-build/PIL/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/3_/tp_3vp9966dc65phynpzl04h0000gn/T/pip-QFMx2t-record/install-record.txt --single-version-externally-managed:
    WARNING: '' not a valid package name; please use only.-separated package names in setup.py

running install

running build

running build_py

running build_ext

--- using frameworks at /System/Library/Frameworks

building '_imaging' extension

clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -IlibImaging -I/System/Library/Frameworks/Python.framework/Versions/2.7/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.8-intel-2.7/_imaging.o

unable to execute clang: No such file or directory

error: command 'clang' failed with exit status 1

----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/var/folders/3_/tp_3vp9966dc65phynpzl04h0000gn/T/pip-build/PIL/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/3_/tp_3vp9966dc65phynpzl04h0000gn/T/pip-QFMx2t-record/install-record.txt --single-version-externally-managed failed with error code 1 in /var/folders/3_/tp_3vp9966dc65phynpzl04h0000gn/T/pip-build/PIL
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 8, in <module>
    load_entry_point('pip==1.2', 'console_scripts', 'pip')()
  File "/Library/Python/2.7/site-packages/pip/__init__.py", line 111, in main
    return command.main(args[1:], options)
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 145, in main
    temp = tempfile.NamedTemporaryFile(delete=False)
NameError: global name 'tempfile' is not defined

为什么!?

推荐答案

在安装Xcode时,您需要安装Xcode命令行工具(默认情况下未选中).根据您的xcode版本,您可以选择在首选项的下载"面板中安装命令行工具,也可以选择重新安装.

You need to install the Xcode command line tools (which is not selected by default) when you install Xcode. Depending on your xcode version, you can either select to install the command line tools in the downloads panel of the preferences, or by reinstalling.

这篇关于我无法在Osx中安装"pip install pil"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆