python - 在 MacOSX 上编译coverage.py 时出错

标签 python macos installation compiler-errors coverage.py

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

$ 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 cover ;结果差别不大:

...
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 的情况。

最佳答案

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

ARCHFLAGS="-arch i386 -arch x86_64" easy_install coverage

关于python - 在 MacOSX 上编译coverage.py 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5793709/

相关文章:

Python Find max in dataframe 列以循环查找所有值

python - 具有相似字符串模式的两个数据帧的匹配序列,保持索引和序列

.net - 如何为商业Windows应用创建测试环境?

python - 如何确定 "oscillating"轨迹的幅度和频率

python - 出现错误 : Reshape your data either using array

swift - 异步自动释放池

macos - 确定 OS X 沙箱下符号链接(symbolic link)指向的文件的大小

c - 使用信号量的程序在 Linux 上运行良好...在 Mac osX 上出现意外结果

PHP/MySQL 独立安装程序/更新程序脚本?

.net - 如何构建更新通知?