3

Xcode 安装完毕,python+django 启动并顺利运行。

我正在写运行:

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

为什么!?

4

1 回答 1

8

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

于 2012-09-18T22:36:23.370 回答