您好我正在尝试在“www.pythonware.com/products/pil”安装python图像库,并且遇到了一些错误。见下面的终端。
cfarm:Desktop christopherfarm$ cd Imaging-1.1.7
cfarm:Imaging-1.1.7 christopherfarm$ ls
BUILDME Docs PIL Sane _imaging.c _imagingmath.c decode.c encode.c outline.c setup.py
CHANGES Images PIL.pth Scripts _imagingcms.c _imagingtk.c display.c libImaging path.c
CONTENTS MANIFEST README Tk _imagingft.c build doctest.py map.c selftest.py
cfarm:Imaging-1.1.7 christopherfarm$ sudo python setup.py install
running install
running build
running build_py
running build_ext
--- using frameworks at /System/Library/Frameworks
building '_imaging' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -IlibImaging -I/opt/local/include -I/System/Library/Frameworks/Python.framework/Versions/2.6/include -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _imaging.c -o build/temp.macosx-10.6-universal-2.6/_imaging.o
_imaging.c:3017: warning: initialization from incompatible pointer type
_imaging.c:3077: warning: initialization from incompatible pointer type
/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed
Installed assemblers are:
/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386
_imaging.c:3017: warning: initialization from incompatible pointer type
_imaging.c:3077: warning: initialization from incompatible pointer type
_imaging.c:3281: fatal error: error writing to -: Broken pipe
compilation terminated.
_imaging.c:3017: warning: initialization from incompatible pointer type
_imaging.c:3077: warning: initialization from incompatible pointer type
lipo: can't open input file: /var/folders/64/64XKmTbXF+mgCYEKEqHbJk+++TI/-Tmp-//cce5jySl.out (No such file or directory)
error: command 'gcc-4.2' failed with exit status 1
答案 0 :(得分:3)
我强烈建议您安装homebrew。他们有PIL formula,您可以安装:
brew install pil
答案 1 :(得分:0)
尝试使用sudo运行。
sudo python setup.py install
答案 2 :(得分:-1)
PIL正在尝试使用“gcc-4.2”而不是“gcc”,因为这是用于构建Python的内容。试试这个
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
sudo python setup.py install