xcode 使用 Xcode4 在 OS X Snow Leopard 上安装 PIL(不支持 PPC)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5366882/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Installing PIL on OS X Snow Leopard w/Xcode4 (no PPC support)
提问by Ben Keating
Xcode4 dropped PPC support, so when I try building PIL, it throws hate:
Xcode4 放弃了 PPC 支持,所以当我尝试构建 PIL 时,它引发了仇恨:
Bens-MacBook-Air:Imaging-1.1.7 bkeating$ python setup.py build
running buildrunning build_pyrunning build_ext
--- using frameworks at /System/Library/Frameworks
building '_imaging' extension
/usr/bin/gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -DHAVE_LIBJPEG -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -I/usr/local/include/freetype2 -IlibImaging -I/System/Library/Frameworks/Python.framework/Versions/2.6/include -I/usr/local/include -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c decode.c -o build/temp.macosx-10.6-universal-2.6/decode.o
/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
decode.c:688: fatal error: error writing to -: Broken pipe
compilation terminated.
lipo: can't open input file: /var/folders/jW/jW0VkC8uEb4lAjcJou+OaU+++TI/-Tmp-//ccEmCpUp.out (No such file or directory)
error: command '/usr/bin/gcc-4.0' failed with exit status 1
I ran that first line, manually, and removed the -arch ppc
option and it didn't report back with any errors, but rerunning the build process ignores this manual attempt. `gcc-4.0 also does not exist, I symlinked it to gcc-4.2.
我手动运行了第一行,然后删除了该-arch ppc
选项,它没有报告任何错误,但重新运行构建过程会忽略此手动尝试。`gcc-4.0 也不存在,我将它符号链接到 gcc-4.2。
I could go ahead and install Xcode3 and then 4, but I want to muck up my fresh install.
我可以继续安装 Xcode3,然后安装 4,但我想搞砸我的全新安装。
Is there anyway to tell PIL to not compile for PPC? I did a grep across the distribution but i did not find a single mention of PPC
. Any ideas?
无论如何告诉PIL不要为PPC编译?我在整个发行版中做了一个 grep,但我没有发现一个关于PPC
. 有任何想法吗?
回答by Ben Keating
The solution has nothing to do with PIL but rather setting gcc's ARCHFLAGS:
该解决方案与PIL无关,而是设置gcc的ARCHFLAGS:
ARCHFLAGS="-arch i386 -arch x86_64" sudo pip install PIL
回答by alphageek
ARCHFLAGS doesn't seem to get passed into sudo. I had to do
ARCHFLAGS 似乎没有传递给 sudo。我必须做
sudo -s
then ARCHFLAGS="-arch i386 -arch x86_64" pip install PIL
to make it work.
然后ARCHFLAGS="-arch i386 -arch x86_64" pip install PIL
让它工作。
回答by gawbul
A better way to solve this issue, in my opinion, would be to edit your ~/.profile or /etc/bashrc and add the line:
在我看来,解决此问题的更好方法是编辑您的 ~/.profile 或 /etc/bashrc 并添加以下行:
export ARCHFLAGS="-arch i386 -arch x86_64"
Will save messing around with any future installations (I've just had to do this for installing lots of Perl modules in CPAN)!
将省去任何未来安装的麻烦(为了在 CPAN 中安装大量 Perl 模块,我只需要这样做)!
回答by sthartle
Just to help others... I had to use ARCHFLAGS="-arch x86_64" before building imaging with my Snow Leopard/XCode 4 system i.e. having "-arch i386" in their stopped it working for me.
只是为了帮助其他人...在使用我的 Snow Leopard/XCode 4 系统构建成像之前,我不得不使用 ARCHFLAGS="-arch x86_64",即在他们的“-arch i386”中停止它对我来说有效。