2012-03-15 27 views
0

我想在Mac OS X 10.7.2中安裝Mysql Python。出現以下錯誤:Mysql Python 1.2.3

running build_ext 
building '_mysql' extension 
llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/Applications/MAMP/Library/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.7-intel-2.7/_mysql.o -fno-omit-frame-pointer -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL 
unable to execute llvm-gcc-4.2: No such file or directory 
error: command 'llvm-gcc-4.2' failed with exit status 1 

我該如何解決問題。

我使用: 的Python 2.7.1 臨Mysql的44年5月1日(32位,與MAMP Pro的捆綁)

[更新:2012年3月18日] 安裝Xcode和命令行工具後,在我嘗試安裝MySQL的Python,得到了以下

_mysql.c: In function ‘_mysql_ConnectionObject_get_host_info’: 
_mysql.c:1618: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c:1619: warning: implicit declaration of function ‘mysql_get_host_info’ 
_mysql.c:1619: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ 
_mysql.c:1619: warning: passing argument 1 of ‘PyString_FromString’ makes pointer from integer without a cast 
_mysql.c: In function ‘_mysql_ConnectionObject_get_proto_info’: 
_mysql.c:1633: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c:1634: warning: implicit declaration of function ‘mysql_get_proto_info’ 
_mysql.c:1634: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ 
_mysql.c: In function ‘_mysql_ConnectionObject_get_server_info’: 
_mysql.c:1648: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c:1649: warning: implicit declaration of function ‘mysql_get_server_info’ 
_mysql.c:1649: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ 
_mysql.c:1649: warning: passing argument 1 of ‘PyString_FromString’ makes pointer from integer without a cast 
_mysql.c: In function ‘_mysql_ConnectionObject_info’: 
_mysql.c:1665: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c:1666: warning: implicit declaration of function ‘mysql_info’ 
_mysql.c:1666: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ 
_mysql.c:1666: warning: assignment makes pointer from integer without a cast 
_mysql.c: In function ‘_mysql_ConnectionObject_insert_id’: 
_mysql.c:1698: error: ‘my_ulonglong’ undeclared (first use in this function) 
_mysql.c:1698: error: expected ‘;’ before ‘r’ 
_mysql.c:1700: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c:1702: error: ‘r’ undeclared (first use in this function) 
_mysql.c:1702: warning: implicit declaration of function ‘mysql_insert_id’ 
_mysql.c:1702: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ 
_mysql.c: In function ‘_mysql_ConnectionObject_kill’: 
_mysql.c:1719: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c:1721: warning: implicit declaration of function ‘mysql_kill’ 
_mysql.c:1721: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ 
_mysql.c: In function ‘_mysql_ConnectionObject_field_count’: 
_mysql.c:1740: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c:1742: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ 
_mysql.c: In function ‘_mysql_ResultObject_num_fields’: 
_mysql.c:1757: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c:1758: error: ‘_mysql_ResultObject’ has no member named ‘result’ 
_mysql.c: In function ‘_mysql_ResultObject_num_rows’: 
_mysql.c:1773: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c:1774: error: ‘_mysql_ResultObject’ has no member named ‘result’ 
_mysql.c: In function ‘_mysql_ConnectionObject_ping’: 
_mysql.c:1803: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c:1804: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ 
_mysql.c:1806: warning: implicit declaration of function ‘mysql_ping’ 
_mysql.c:1806: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ 
_mysql.c: In function ‘_mysql_ConnectionObject_query’: 
_mysql.c:1827: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c:1829: warning: implicit declaration of function ‘mysql_real_query’ 
_mysql.c:1829: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ 
_mysql.c: In function ‘_mysql_ConnectionObject_select_db’: 
_mysql.c:1857: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c:1859: warning: implicit declaration of function ‘mysql_select_db’ 
_mysql.c:1859: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ 
_mysql.c: In function ‘_mysql_ConnectionObject_shutdown’: 
_mysql.c:1878: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c:1880: warning: implicit declaration of function ‘mysql_shutdown’ 
_mysql.c:1880: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ 
_mysql.c: In function ‘_mysql_ConnectionObject_stat’: 
_mysql.c:1905: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c:1907: warning: implicit declaration of function ‘mysql_stat’ 
_mysql.c:1907: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ 
_mysql.c:1907: warning: assignment makes pointer from integer without a cast 
_mysql.c: In function ‘_mysql_ConnectionObject_store_result’: 
_mysql.c:1928: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c:1929: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’ 
_mysql.c:1938: error: ‘_mysql_ResultObject’ has no member named ‘result’ 
_mysql.c: In function ‘_mysql_ConnectionObject_thread_id’: 
_mysql.c:1967: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c:1969: warning: implicit declaration of function ‘mysql_thread_id’ 
_mysql.c:1969: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ 
_mysql.c: In function ‘_mysql_ConnectionObject_use_result’: 
_mysql.c:1989: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c:1990: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’ 
_mysql.c:1999: error: ‘_mysql_ResultObject’ has no member named ‘result’ 
_mysql.c: In function ‘_mysql_ConnectionObject_dealloc’: 
_mysql.c:2017: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c: In function ‘_mysql_ConnectionObject_repr’: 
_mysql.c:2029: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c:2030: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ 
_mysql.c: In function ‘_mysql_ResultObject_data_seek’: 
_mysql.c:2048: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c:2049: warning: implicit declaration of function ‘mysql_data_seek’ 
_mysql.c:2049: error: ‘_mysql_ResultObject’ has no member named ‘result’ 
_mysql.c: In function ‘_mysql_ResultObject_row_seek’: 
_mysql.c:2062: error: ‘MYSQL_ROW_OFFSET’ undeclared (first use in this function) 
_mysql.c:2062: error: expected ‘;’ before ‘r’ 
_mysql.c:2064: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c:2065: error: ‘_mysql_ResultObject’ has no member named ‘use’ 
_mysql.c:2070: error: ‘r’ undeclared (first use in this function) 
_mysql.c:2070: warning: implicit declaration of function ‘mysql_row_tell’ 
_mysql.c:2070: error: ‘_mysql_ResultObject’ has no member named ‘result’ 
_mysql.c:2071: warning: implicit declaration of function ‘mysql_row_seek’ 
_mysql.c:2071: error: ‘_mysql_ResultObject’ has no member named ‘result’ 
_mysql.c: In function ‘_mysql_ResultObject_row_tell’: 
_mysql.c:2083: error: ‘MYSQL_ROW_OFFSET’ undeclared (first use in this function) 
_mysql.c:2083: error: expected ‘;’ before ‘r’ 
_mysql.c:2085: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c:2086: error: ‘_mysql_ResultObject’ has no member named ‘use’ 
_mysql.c:2091: error: ‘r’ undeclared (first use in this function) 
_mysql.c:2091: error: ‘_mysql_ResultObject’ has no member named ‘result’ 
_mysql.c:2092: error: ‘_mysql_ResultObject’ has no member named ‘result’ 
_mysql.c: In function ‘_mysql_ResultObject_dealloc’: 
_mysql.c:2100: warning: implicit declaration of function ‘mysql_free_result’ 
_mysql.c:2100: error: ‘_mysql_ResultObject’ has no member named ‘result’ 
_mysql.c: At top level: 
_mysql.c:2331: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 
_mysql.c:2338: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’ 
_mysql.c:2345: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ 
_mysql.c:2352: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ 
_mysql.c:2359: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ 
_mysql.c:2422: error: ‘_mysql_ResultObject’ has no member named ‘converter’ 
_mysql.c:2422: error: initializer element is not constant 
_mysql.c:2422: error: (near initialization for ‘_mysql_ResultObject_memberlist[0].offset’) 
_mysql.c: In function ‘_mysql_ConnectionObject_getattr’: 
_mysql.c:2444: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ 

脂:無法打開輸入文件:/var/tmp//ccYLieFH.out(沒有這樣的文件或目錄)

有很多這樣的行

+0

看起來你沒有安裝編譯器,但我不知道,因爲我沒有Mac – Dikei 2012-03-15 07:36:51

+0

你有沒有安裝xcode? – 2012-03-15 08:02:20

+0

我沒有安裝任何編譯器或xcode。我需要安裝它們嗎? – Elisa 2012-03-15 08:13:05

回答

1

您需要前往應用商店。下載Xcode。一旦安裝到Xcode->首選項 - >下載並安裝「命令行工具」。然後再次運行python setup.py build它應該可以工作

+0

謝謝法案,我照你所說的做了。但仍然有錯誤: _mysql.c:1740:錯誤:'_mysql_ConnectionObject'沒有名爲'open'的成員 _mysql.c:1742:error:'_mysql_ConnectionObject'沒有名爲'connection'的成員 _mysql.c:在函數'_mysql_ResultObject_num_fields' – Elisa 2012-03-18 11:17:33