2014-02-07 77 views
6

我是Mac新手,我試圖在MAC上安裝MySQLdb for MySQL,但是按照http://www.tutorialspoint.com/python/python_database_access.htm提到的步驟後,運行後收到錯誤錯誤:命令'cc'失敗,退出狀態1 - 在MAC上安裝MySQLdb

$ python setup.py build 

錯誤:

clang: warning: argument unused during compilation: '-mno-fused-madd' 
_mysql.c:44:10: fatal error: 'my_config.h' file not found 
#include "my_config.h" 
    ^
1 error generated. 
error: command 'cc' failed with exit status 1 

注:我的 「mysql_config」 路徑爲/ Applications/MAMP /庫/斌/ mysql_config 我應該怎麼辦?

+0

你檢查出這個帖子? http://stackoverflow.com/questions/15505840/how-to-install-mysql-python-1-2-3-on-mac-os-10-8 –

+0

是的,我已經有XAMPP和XAMPP有MySQL - 現在我想用XAMPP –

回答

9

問題是未使用的參數傳遞給編譯器。運行您的構建代碼之前,試試這個:

export CFLAGS=-Qunused-arguments 
export CPPFLAGS=-Qunused-arguments 
+4

中現有的MySQL來解決這個問題,這是行不通的! – redrubia

+1

'Mac OS X'10.9 Mavericks'對我來說很完美。謝謝! – andi

+0

在小牛隊爲我+1。謝謝! – infiniteloop

2

嘗試在終端上設置此執行前:

export CC='/usr/bin/gcc' 
export CFLAGS='-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -I/opt/X11/include -arch i386 -arch x86_64' 
export LDFLAGS='-arch i386 -arch x86_64' 
export ARCHFLAGS='-arch i386 -arch x86_64' 

在這裏找到:https://jamesfriend.com.au/installing-pygame-python-mac-os-108-mountain-lion

+0

對於OSX El Capitan:使用上面的CFLAGS: export CFLAGS =' - isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include -arch i386 -arch x86_64' –

相關問題