2012-02-25 102 views
4

我一直在尋找解決方案,似乎有很多不同的解決方案,但似乎沒有任何工作。MySQL-python,錯誤:命令'gcc-4.2'失敗,退出狀態1

我正在使用MySQL-Python嘗試使用python設置MySQL。但是,當我嘗試運行

sudo python setup.py build 

我得到以下錯誤:

Password: 
running build 
running build_py 
copying MySQLdb/release.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb 
running build_ext 
building '_mysql' extension 
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -g -O2 -DNDEBUG -g -O3 -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/mysql-5.5.21-osx10.6-x86/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.6-intel-2.7/_mysql.o -Os -g -fno-common -fno-strict-aliasing -arch i386 
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 pymemcompat.h:10, 
      from _mysql.c:29: 
/Developer/SDKs/MacOSX10.6.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory 
In file included from _mysql.c:36: 
/usr/local/mysql-5.5.21-osx10.6-x86/include/my_config.h:329:1: warning: "SIZEOF_SIZE_T" redefined 
In file included from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:9, 
      from pymemcompat.h:10, 
      from _mysql.c:29: 
/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pymacconfig.h:56:1: warning: this is the location of the previous definition 
In file included from _mysql.c:36: 
/usr/local/mysql-5.5.21-osx10.6-x86/include/my_config.h:422:1: warning: "HAVE_WCSCOLL" redefined 
In file included from  /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:8, 
      from pymemcompat.h:10, 
      from _mysql.c:29: 
/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pyconfig.h:887:1: warning: this is the location of the previous definition 
error: command 'gcc-4.2' failed with exit status 1 
+1

「許多不同的解決方案,但似乎沒有任何工作」。請具體說明。你試過了什麼?發生了什麼? – 2012-02-26 00:10:39

+0

http://stackoverflow.com/questions/8473066/gcc-4-2-failed-with-exit-status-1,同樣的錯誤跟在 – varatis 2012-02-26 17:02:30

+0

也http://justcramer.com/2007/11/05/mysqldb- on-leopard /,但我甚至沒有找到他們正在談論的線路,並且錯誤似乎並不完全相同 – varatis 2012-02-26 17:05:49

回答

1

我有同樣的問題。經過幾個小時的苦苦掙扎後,我成功地使用了ActivePython(http://code.activestate.com/pypm/mysql-python/)來安裝MySQL-python。雖然它不能完全解決您的錯誤,但它解決了整體問題:)

+0

謝謝。是的,我剛剛結束了SQLite的臨時使用,但我認爲這只是當你必須嘗試安裝不同的東西的時候。 – varatis 2012-03-03 21:12:18

相關問題