python - 为什么 GCC 忽略 Snow Leopard 中的 ARCHFLAGS?

标签 python macos gcc virtualenv pip

我正在尝试安装 AMFASTvirtual_env基于依赖文件的位置。我在我的本地 .profile 中有 export ARCHFLAGS="-arch x86_64",并通过运行 env 并看到它列出来确认它的存在。但是,每当我针对虚拟环境运行 PIP 时,gcc 都会设置为针对 i386 和 ppc。我还尝试在 PIP 命令中添加 env ARCHFLAGS="-arch i386 -arch x86_64"env ARCHFLAGS="-arch x86_64" ,但 gcc 始终具有标记 -arch i386 -arch ppc -arch x86_64。我怎样才能让 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

最佳答案

最有可能的问题是 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`

关于python - 为什么 GCC 忽略 Snow Leopard 中的 ARCHFLAGS?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6988528/

相关文章:

cocoa - 捕获 subview 的 mouseDown 事件。 ( cocoa OSX)

python - 不需要的空白导致列扭曲

c - 如何在 Mac OSx 上处理来自外部程序的数据

swift - 如何在某些特定条件下使用 swift 禁用 Collection View 中的滚动

c - Break 语句在循环中不起作用 (gcc)

c位运算bug

python - 如何将 pandas loc 索引器转换为字符串?

python - 在 python 中使用 Pandas 合并后如何查找丢失的数据?

python - 在 Python 中读取文件

c++ - GCC 中地址清理程序的有意义的堆栈跟踪