2

我尝试在当前 Mac OS X 10.6.7 上运行的 MacBook 上安装coverage 3.4 。这是我得到的错误:

$ easy_install coverage
install_dir /Users/jammon/workspace/myproject/lib/python2.7/site-packages/
Searching for coverage
Reading http://pypi.python.org/simple/coverage/
Reading http://nedbatchelder.com/code/modules/coverage.html
Reading http://nedbatchelder.com/code/coverage
Reading http://nedbatchelder.com/code/coverage/3.4b1
Reading http://nedbatchelder.com/code/coverage/3.4b2
Best match: coverage 3.4
Downloading http://pypi.python.org/packages/source/c/coverage/coverage-3.4.tar.gz#md5=46782809578c8fd29912c124d2420842
Processing coverage-3.4.tar.gz
Running coverage-3.4/setup.py -q bdist_egg --dist-dir /var/folders/10/10P5vwX-Ghmkg8s25PMr3E+++TI/-Tmp-/easy_install-UcskZB/coverage-3.4/egg-dist-tmp-QCs3YS
no previously-included directories found matching 'test'
In file included from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h:4,
                 from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:85,
                 from coverage/tracer.c:3:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
In file included from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h:4,
                 from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:85,
                 from coverage/tracer.c:3:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
lipo: can't figure out the architecture type of: /var/folders/10/10P5vwX-Ghmkg8s25PMr3E+++TI/-Tmp-//ccAYGjpc.out
error: Setup script exited with error: command 'gcc-4.0' failed with exit status 1

任何人都可以从中理解吗?我只是不明白出了什么问题。或者我该如何解决。
非常感谢任何帮助。

更新:
在 Ned 发表评论后,我尝试使用easy_install -vv coverage; 结果并没有太大的不同:

...
creating build/temp.macosx-10.3-fat-2.7/coverage
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c coverage/tracer.c -o build/temp.macosx-10.3-fat-2.7/coverage/tracer.o
In file included from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h:4,
                 from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:85,
                 from coverage/tracer.c:3:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
In file included from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h:4,
                 from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:85,
                 from coverage/tracer.c:3:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
lipo: can't figure out the architecture type of: /var/folders/10/10P5vwX-Ghmkg8s25PMr3E+++TI/-Tmp-//ccZQsHOd.out
error: Setup script exited with error: command 'gcc-4.0' failed with exit status 1

据我记得,我以标准方式从源代码编译 python,它不是二进制分发。我尝试了有无virtualenv.

4

3 回答 3

6

最新版本的 XCode 删除了对编译到旧 PowerPC (PPC) 架构的支持。不幸的是,Mac 上的 Python 通常仍会尝试为 PPC 和 x86 构建 C 扩展。要解决此问题,请使用 ARCHFLAGS 设置为“setup.py install”或“easy_install”等命令添加前缀,该设置仅包含您要为其构建的架构:

ARCHFLAGS="-arch i386 -arch x86_64" easy_install coverage
于 2011-04-27T15:02:23.087 回答
0

经过大量谷歌搜索后,我在这篇博文和评论中找到了一个对我有用的解决方案:我删除了 /Developer/SDKs/MacOSX10.4u.sdk,然后安装覆盖率(和显示相同问题的报告实验室)就像预期的。

据我了解,在某些版本的 gcc 中对 stdarg.h 的处理发生了变化,导致了所描述的问题。

于 2011-06-05T06:15:40.130 回答
0

或者,您可以使用ActivePython来避免自己编译的需要:

$ pypm install coverage
The following packages will be installed into "~/Library/Python/2.7" (2.7):
 coverage-3.4
Get: [pypm-free.activestate.com] coverage 3.4
Installing coverage-3.4                                  
Fixing script ~/Library/Python/2.7/bin/coverage
$
于 2011-05-01T20:26:23.667 回答