2012-03-07 69 views
1

我已經在Mac OS x 10.5.8上從python.org安裝了python-2.7-macosx10.5.dmg。無法在mac上構建pyPortMidi

我發出:蟒蛇setup.py建立pyPortMidi-0.0.3

並獲得:

Found darwin (OS X) platform 
running build 
running build_ext 
pyrexc pypm.pyx --> pypm.c 
/Users/baz/Downloads/pyPortMidi-0.0.3/pypm.pyx:357:21: Type 'PmError' not acceptable as a boolean 
building 'pypm' extension 
creating build/temp.macosx-10.5-intel-2.7 
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -O3 -arch i386 -arch x86_64 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pypm.c -o build/temp.macosx-10.5-intel-2.7/pypm.o 
pypm.c:1:2: error: #error Do not use this file, it is the result of a failed Pyrex compilation. 
pypm.c:1:2: error: #error Do not use this file, it is the result of a failed Pyrex compilation. 
lipo: can't figure out the architecture type of: /var/folders/oO/oO1flrWgHAC8u6KdoO0Wq++++TI/-Tmp-//ccTcgy0s.out 
error: command 'gcc-4.0' failed with exit status 1 

誰能幫我解決這個問題?

+0

看看這裏的注意事項: http://cratel.wichita.edu/cratel/cratel%20pyportmidi#build_on_OS_X – 2012-03-08 14:04:59

回答

0

我發現最簡單的方法是構建包含在pygame中的pyPortMidi版本,該版本應用了一些修復程序。

您可以使用以下模式將它導入到您的文件頂部,更喜歡標準版本,但會回到pygame捆綁版本。

try: 
    import pypm 
except ImportError: 
    from pygame import pypm 

使用MacPorts的,很容易使用安裝:

port install py27-game +portmidi 

我不知道,如果你需要一些特別的東西,包括在構建portmidi如果通過其他方法構建。