问题
bash-3.2$ sudo easy_install appscript
Password:
Searching for appscript
Reading http://pypi.python.org/simple/appscript/
Reading http://appscript.sourceforge.net
Best match: appscript 1.0.0
Downloading http://pypi.python.org/packages/source/a/appscript/appscript-1.0.0.tar.gz#md5=6619b637037ea0f391f45870c13ae38a
Processing appscript-1.0.0.tar.gz
Running appscript-1.0.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-C4d1az/appscript-1.0.0/egg-dist-tmp-yVTHww
/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
I'm a pretty big noob at this stuff (I've learned to use python and unix a bit, but I've never had to deal with installation.) Earlier I was getting an error related to gcc-4.2 not being found, and I found some posts that recommended reinstalling XCode. I went with 4.0 (bad choice?) and now I get this. I've got no idea what to do at this point.
回答1:
This happened for me after having upgraded to XCode 4; I haven't had time to figure out what went wrong during the upgrade (or whether this is the intended behaviour), but the following workaround works for me:
sudo env ARCHFLAGS="-arch i386" easy_install whatever
The ARCHFLAGS
trick works with setup.py
as well:
env ARCHFLAGS="-arch i386 -arch x86_64" python setup.py install
回答2:
I found another solution here which solves the problem once and for all. It turns out XCode4 still has the ppc assembler. You just need a symlink to it in the right place:
$ sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/usr/libexec/gcc/darwin/ppc /Developer/usr/libexec/gcc/darwin
$ sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/usr/libexec/gcc/darwin/ppc /usr/libexec/gcc/darwin
Fixed the problem for me with XCode4 installed on Snow Leopard.
EDIT: I tried other solutions, which worked in some cases, but invariably encountered a package that hardcoded the PPC requirement somewhere. Providing the PPC assembler got rid of all these problems once and for all.
回答3:
For me, the key was the ppc assembler, not the ARCHFLAGS stuff. But, the suggestion above didn't work; I didn't have the files in those locations. But with some tinkering and poking around, I found that I did have the ppc assember at /usr/bin/as
. I first tried sudo ln -s /usr/bin/as /usr/libexec/as/ppc/as
, but that failed (something about could not fork process...??). So I ended up just doing sudo cp /usr/bin/as /usr/libexec/as/ppc/as
, and that worked (I think I had to do some sudo mkdir
s along that path, as well).
回答4:
Using the system Pythons on Mac OS X 10.6, you'll need to have the gcc-4.2 from the Apple Xcode Developer Tools installed to build extension modules, like with Appscript. Other products may need the Xcode gcc-4.0 so you should install them both. They co-exist just fine.
来源:https://stackoverflow.com/questions/5256397/python-easy-install-fails-with-assembler-for-architecture-ppc-not-installed-on