2011-04-26 71 views
2

我試圖在當前Mac OS X 10.6.7上運行的MacBook上安裝coverage 3.4。這是我得到的一個錯誤:在MacOSX上編譯coverage.py時出錯

$ 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

+0

這很奇怪。安裝這個應該不會有問題。嘗試使用'easy_install -vv coverage'重新運行並報告整個'gcc'命令。 *你的* 10.4 * SDK可能有問題。你可以嘗試從Xcode 3安裝程序重新安裝。 – 2011-04-26 17:55:20

回答

6

最新版本的XCode取消了對編譯爲舊PowerPC(PPC)體系結構的支持。不幸的是,Mac上的Python通常仍然試圖爲PPC和x86構建C擴展。爲了解決這個問題,前綴的命令,如與ARCHFLAGS設置只包括要建立的體系結構「的setup.py安裝」或「的easy_install」:

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

這聽起來很像解決方案;但不幸的是,我仍然得到同樣的錯誤。我真的需要花些時間對問題的原因進行一些研究。不管怎麼說,還是要謝謝你。 – jammon 2011-04-27 16:39:44

+1

你還得到'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 ' -arch ppc'在中間?這是不好的部分。 – abdelazer 2011-04-27 18:21:28

+0

這工作對我來說,編譯Mac OS X 10.8(山獅)lxml(2.3.5)的最新版本。 – mgrandi 2012-09-04 23:19:56

0

或者,您可以use ActivePython以避免需要compile things yourself

$ 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 
$ 
0

經過大量谷歌上搜索我的發現this blogpost and the comments的解決方案,爲我工作:我取下/Developer/SDKs/MacOSX10.4u.sdk,然後安裝覆蓋(和ReportLab的,這顯示了同樣的問題)按預期工作。

就我所知,stdarg.h的處理在gcc的某個版本中已經改變,導致所描述的問題。