2011-08-08 8 views
5

我試圖根據依賴關係文件在virtual_env位置安裝AMFAST。我在本地.profile中有export ARCHFLAGS="-arch x86_64",並且已通過運行env並將其列出來確認其存在。但是,每當我運行PIP以虛擬環境爲目標時,gcc被設置爲目標i386和ppc。我也嘗試了env ARCHFLAGS="-arch i386 -arch x86_64"env ARCHFLAGS="-arch x86_64"到PIP命令,但gcc總是有-arch i386 -arch ppc -arch x86_64標誌。我怎樣才能讓gcc閱讀我的archflags?爲什麼GCC忽略雪豹中的ARCHFLAGS?

例如:

sudo pip install -E ~/Documents/project/project_env -r ~/Documents/project/trunk/django/dependencies.txt` 

輸出
...

Running setup.py install for amfast 
    building 'amfast.encode' 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 -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c amfast/ext_src/encoder.c -o build/temp.macosx-10.6-universal-2.6/amfast/ext_src/encoder.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 
    amfast/ext_src/encoder.c:2121: fatal error: error writing to -: Broken pipe 
    compilation terminated. 
    lipo: can't open input file: /var/tmp//ccoYlfhN.out (No such file or directory) 
    error: command 'gcc-4.2' failed with exit status 1 
+0

什麼弓是你的Python - 畫中畫等會挑選了 – Mark

回答

14

最有可能的問題是ARCHFLAGS環境變量沒有被通過sudo通過。默認情況下,某些版本的sudo會將大多數env變量過濾爲安全措施(請參閱man sudo)。嘗試運行這樣說:

sudo ARCHFLAGS="-arch x86_64" pip install -E ~/Documents/project/project_env -r ~/Documents/project/trunk/django/dependencies.txt` 
+1

如果你不介意的安全問題,你可以添加一行到/ etc /運行sudoers文件「命令visudo命令「並且在默認值env_keep + =」...「的行後添加行Defaults env_keep + =」ARCHFLAGS「。這樣,ARCHFLAGS將由sudo保存。 – blootsvoets