2011-04-07 163 views
1

有人在雪豹上成功安裝PyODBC嗎?雪豹PyODBC - 安裝錯誤

我收到下面的錯誤。 (我也提交了bug here)任何想法如何解決這個問題,並得到它安裝?

這是我得到的輸出:

$ python setup.py install 
running install 
running bdist_egg 
running egg_info 
writing pyodbc.egg-info/PKG-INFO 
writing top-level names to pyodbc.egg-info/top_level.txt 
writing dependency_links to pyodbc.egg-info/dependency_links.txt 
reading manifest file 'pyodbc.egg-info/SOURCES.txt' 
reading manifest template 'MANIFEST.in' 
writing manifest file 'pyodbc.egg-info/SOURCES.txt' 
installing library code to build/bdist.macosx-10.6-universal/egg 
running install_lib 
running build_ext 
building 'pyodbc' 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 -DPYODBC_VERSION=2.1.8 -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c /Users/pinerog/Downloads/pyodbc-2.1.8/src/buffer.cpp -o build/temp.macosx-10.6-universal-2.6/Users/pinerog/Downloads/pyodbc-2.1.8/src/buffer.o 
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++ 
/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/datetime.h:186: warning: ‘PyDateTimeAPI’ defined but not used 
/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 
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++ 
/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/datetime.h:186: warning: ‘PyDateTimeAPI’ defined but not used 
/Users/pinerog/Downloads/pyodbc-2.1.8/src/buffer.cpp:58: fatal error: error writing to -: Broken pipe 
compilation terminated. 
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++ 
/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/datetime.h:186: warning: ‘PyDateTimeAPI’ defined but not used 
lipo: can't open input file: /var/folders/z3/z3Y30fNyGvennzCS3hWhkLlN-Ec/-Tmp-//ccZURNsn.out (No such file or directory) 
error: command 'gcc-4.2' failed with exit status 1 

版本:2.1.8 PyODBC的Mac 10.6.7和Python 2.6.1

回答

2

你的問題可能是xcode 4和setuptools的結合。看到這個錯誤:

/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/datetime.h:186: warning: ‘PyDateTimeAPI’ defined but not used 
/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 

setuptools嘗試爲ppc編譯,但xcode 4不再支持它。

嘗試編譯如下:

ARCHFLAGS="-arch i386 -arch x86_64" python setup.py install 
+0

哇,工作!謝謝! – Greg 2011-04-07 17:37:47

1

我使用的MacPorts安裝pyodbc

sudo port install py26-odbc

py26-odbc適用於python 2.6。如果你使用Python 2.7,名字應該是py27-odbc

+0

看起來不錯。我安裝它,但它說當我運行該命令時沒有找到命令。 – Greg 2011-04-07 17:12:41

+0

@Greg檢查http://www.macports.org/install.php。或者嘗試打開一個新的終端。 – WenbinWu 2011-04-07 18:28:53