MySQLdb Python 连接器构建和安装命令“gcc-4.2”失败,退出状态为 255
Posted
技术标签:
【中文标题】MySQLdb Python 连接器构建和安装命令“gcc-4.2”失败,退出状态为 255【英文标题】:MySQLdb Python connector building and installation command 'gcc-4.2' failed with exit status 255 【发布时间】:2012-01-27 05:39:49 【问题描述】:我正在运行 Mac Lion。我已经安装了 python 2.7.2 和 django 1.3.1。他们都工作正常。为了使 python 与 mysql 一起工作,我必须安装 MySQL-python-1.2.3——但我无法让构建工作。对于 MySQL,我有 XAMPP,并且我已将 XAMPP 的 bin 设置为构建所需的 mysql_config 的系统环境路径。
SOFXGF-AIR:MySQL-python-1.2.3 Sofia$ python setup.py buildrunning 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/Applications/XAMPP/xamppfiles/include/mysql -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 -mmacosx-version-min=10.4 -arch i386 -arch ppc -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL
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
_mysql.c:36:23: error: my_config.h: No such file or directory
_mysql.c:38:19: error: mysql.h: No such file or directory
_mysql.c:39:26: error: mysqld_error.h: No such file or directory
_mysql.c:40:20: error: errmsg.h: No such file or directory
_mysql.c:76: error: expected specifier-qualifier-list before ‘MYSQL’
_mysql.c:90: error: expected specifier-qualifier-list before ‘MYSQL_RES’
_mysql.c: In function ‘_mysql_Exception’:
_mysql.c:120: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:123: error: ‘CR_MAX_ERROR’ undeclared (first use in this function)
_mysql.c:123: error: (Each undeclared identifier is reported only once
_mysql.c:123: error: for each function it appears in.)
_mysql.c:131: error: ‘CR_COMMANDS_OUT_OF_SYNC’ undeclared (first use in this function)
_mysql.c:132: error: ‘ER_DB_CREATE_EXISTS’ undeclared (first use in this function)
_mysql.c:133: error: ‘ER_SYNTAX_ERROR’ undeclared (first use in this function)
_mysql.c:134: error: ‘ER_PARSE_ERROR’ undeclared (first use in this function)
_mysql.c:135: error: ‘ER_NO_SUCH_TABLE’ undeclared (first use in this function)
_mysql.c:136: error: ‘ER_WRONG_DB_NAME’ undeclared (first use in this function)
_mysql.c:137: error: ‘ER_WRONG_TABLE_NAME’ undeclared (first use in this function)
_mysql.c:138: error: ‘ER_FIELD_SPECIFIED_TWICE’ undeclared (first use in this function)
_mysql.c:139: error: ‘ER_INVALID_GROUP_FUNC_USE’ undeclared (first use in this function)
_mysql.c:140: error: ‘ER_UNSUPPORTED_EXTENSION’ undeclared (first use in this function)
_mysql.c:141: error: ‘ER_TABLE_MUST_HAVE_COLUMNS’ undeclared (first use in this function)
_mysql.c:170: error: ‘ER_DUP_ENTRY’ undeclared (first use in this function)
_mysql.c:213: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:213: warning: passing argument 1 of ‘PyString_FromString’ makes pointer from integer without a cast
_mysql.c: In function ‘_mysql_ResultObject_Initialize’:
_mysql.c:363: error: ‘MYSQL_RES’ undeclared (first use in this function)
_mysql.c:363: error: ‘result’ undeclared (first use in this function)
_mysql.c:368: error: ‘MYSQL_FIELD’ undeclared (first use in this function)
_mysql.c:368: error: ‘fields’ undeclared (first use in this function)
_mysql.c:377: error: ‘_mysql_ResultObject’ has no member named ‘use’
_mysql.c:380: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:382: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:383: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:386: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:390: error: ‘_mysql_ResultObject’ has no member named ‘nfields’
_mysql.c:391: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:438: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c: In function ‘_mysql_ResultObject_traverse’:
_mysql.c:450: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:451: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c: In function ‘_mysql_ResultObject_clear’:
_mysql.c:462: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:462: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:462: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:462: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:463: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c: In function ‘_mysql_ConnectionObject_Initialize’:
_mysql.c:475: error: ‘MYSQL’ undeclared (first use in this function)
_mysql.c:475: error: ‘conn’ undeclared (first use in this function)
_mysql.c:500: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:501: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:537: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:540: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:540: error: ‘MYSQL_OPT_CONNECT_TIMEOUT’ undeclared (first use in this function)
_mysql.c:544: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:544: error: ‘MYSQL_OPT_COMPRESS’ undeclared (first use in this function)
_mysql.c:545: error: ‘CLIENT_COMPRESS’ undeclared (first use in this function)
_mysql.c:548: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:548: error: ‘MYSQL_OPT_NAMED_PIPE’ undeclared (first use in this function)
_mysql.c:550: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:550: error: ‘MYSQL_INIT_COMMAND’ undeclared (first use in this function)
_mysql.c:552: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:552: error: ‘MYSQL_READ_DEFAULT_FILE’ undeclared (first use in this function)
_mysql.c:554: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:554: error: ‘MYSQL_READ_DEFAULT_GROUP’ undeclared (first use in this function)
_mysql.c:557: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:557: error: ‘MYSQL_OPT_LOCAL_INFILE’ undeclared (first use in this function)
_mysql.c:565: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:583: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:591: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c: In function ‘_mysql_ConnectionObject_traverse’:
_mysql.c:672: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:673: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c: In function ‘_mysql_ConnectionObject_clear’:
_mysql.c:681: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:681: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:681: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:681: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:682: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c: In function ‘_mysql_ConnectionObject_close’:
_mysql.c:697: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:699: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:701: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c: In function ‘_mysql_ConnectionObject_affected_rows’:
_mysql.c:723: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:724: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_dump_debug_info’:
_mysql.c:758: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:760: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_autocommit’:
_mysql.c:784: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_commit’:
_mysql.c:807: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_rollback’:
_mysql.c:829: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_errno’:
_mysql.c:941: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:942: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_error’:
_mysql.c:957: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:958: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:958: warning: passing argument 1 of ‘PyString_FromString’ makes pointer from integer without a cast
_mysql.c: In function ‘_mysql_escape’:
_mysql.c:1089: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c: In function ‘_mysql_ResultObject_describe’:
_mysql.c:1169: error: ‘MYSQL_FIELD’ undeclared (first use in this function)
_mysql.c:1169: error: ‘fields’ undeclared (first use in this function)
_mysql.c:1172: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1173: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1174: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c: In function ‘_mysql_ResultObject_field_flags’:
_mysql.c:1205: error: ‘MYSQL_FIELD’ undeclared (first use in this function)
_mysql.c:1205: error: ‘fields’ undeclared (first use in this function)
_mysql.c:1208: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1209: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1210: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c: At top level:
_mysql.c:1251: error: expected declaration specifiers or ‘...’ before ‘MYSQL_ROW’
_mysql.c: In function ‘_mysql_row_to_tuple’:
_mysql.c:1257: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1259: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1259: warning: assignment makes pointer from integer without a cast
_mysql.c:1262: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:1263: error: ‘row’ undeclared (first use in this function)
_mysql.c: At top level:
_mysql.c:1276: error: expected declaration specifiers or ‘...’ before ‘MYSQL_ROW’
_mysql.c: In function ‘_mysql_row_to_dict’:
_mysql.c:1281: error: ‘MYSQL_FIELD’ undeclared (first use in this function)
_mysql.c:1281: error: ‘fields’ undeclared (first use in this function)
_mysql.c:1283: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1285: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1285: warning: assignment makes pointer from integer without a cast
_mysql.c:1286: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1289: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:1290: error: ‘row’ undeclared (first use in this function)
_mysql.c: At top level:
_mysql.c:1315: error: expected declaration specifiers or ‘...’ before ‘MYSQL_ROW’
_mysql.c: In function ‘_mysql_row_to_dict_old’:
_mysql.c:1320: error: ‘MYSQL_FIELD’ undeclared (first use in this function)
_mysql.c:1320: error: ‘fields’ undeclared (first use in this function)
_mysql.c:1322: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1324: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1324: warning: assignment makes pointer from integer without a cast
_mysql.c:1325: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1328: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:1329: error: ‘row’ undeclared (first use in this function)
_mysql.c: At top level:
_mysql.c:1351: error: expected declaration specifiers or ‘...’ before ‘MYSQL_ROW’
_mysql.c: In function ‘_mysql__fetch_row’:
_mysql.c:1362: error: ‘MYSQL_ROW’ undeclared (first use in this function)
_mysql.c:1362: error: expected ‘;’ before ‘row’
_mysql.c:1366: error: ‘_mysql_ResultObject’ has no member named ‘use’
_mysql.c:1367: error: ‘row’ undeclared (first use in this function)
_mysql.c:1367: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1370: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1373: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:1381: error: too many arguments to function ‘convert_row’
_mysql.c: In function ‘_mysql_ResultObject_fetch_row’:
_mysql.c:1405: error: expected declaration specifiers or ‘...’ before ‘MYSQL_ROW’
_mysql.c:1420: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1432: error: ‘_mysql_ResultObject’ has no member named ‘use’
_mysql.c:1446: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c: In function ‘_mysql_ConnectionObject_character_set_name’:
_mysql.c:1513: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c: In function ‘_mysql_get_client_info’:
_mysql.c:1604: warning: passing argument 1 of ‘PyString_FromString’ makes pointer from integer without a cast
_mysql.c: In function ‘_mysql_ConnectionObject_get_host_info’:
_mysql.c:1618: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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:2031: 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: 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: error: ‘_mysql_ResultObject’ has no member named ‘result’
_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: 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’
gcc-4.2: error trying to exec '/usr/bin/powerpc-apple-darwin11-gcc-4.2.1': execvp: No such file or directory
lipo: can't figure out the architecture type of: /var/folders/jr/zhr6zd952zv84lqwbhm05k4m0000gn/T//ccthbt7t.out
error: command 'gcc-4.2' failed with exit status 255
我不确定这是否正确,但我也尝试了sudo env ARCHFLAGS='-arch x86_64' python setup.py build
,因为我注意到错误消息中提到了-arch ppc
。但是,我仍然遇到同样的错误。还有可能是关于No such file or directory
错误?我已经安装了 XCode 4。
【问题讨论】:
我有 XAMPP 的 MySQL。我已将 XAMPP 的 bin 添加到系统路径中。 XAMPP 的 MySQL 不行吗? 【参考方案1】:您还需要安装 mysql-devel 软件包。始终注意 .h 扩展文件。如果您因为它们而看到错误,则表示未安装开发人员包,而您正在编译的内容需要它。
由于您使用的是 Mac,因此您需要未编译的 MySQL 源文件,以便它可以访问这些头文件。你可以在这里抓住它:http://dev.mysql.com/downloads/mirror.php?id=405008
您可能必须告诉构建命令这些文件的位置。试试 python ./setup.py --help
【讨论】:
如果有人遇到这个问题需要 ubuntu 的帮助,python 2 和 3 的相关包分别是python-dev
和 python3-dev
。【参考方案2】:
确保你已经安装了mysql:
brew install mysql
如果您拥有它(例如,像 MAMP),请确保 mysql_config
是可运行的(请参阅:site.cfg)。
否则你可以尝试通过其他方式安装mysql-python:
使用ActivePython:
easy_install mysql-connector-python
或使用 MySQL Python 连接器:
pypm install mysql-python
或者您可以从这里下载 MySQL Python 连接器:http://dev.mysql.com/downloads/connector/python/
另请参阅文档:http://dev.mysql.com/doc/refman/5.5/en/connector-python.html
相关:
"Cannot open include file: 'config-win.h': No such file or directory" while installing mysql-python
【讨论】:
【参考方案3】:对我来说:
yum install MySQL-python
【讨论】:
以上是关于MySQLdb Python 连接器构建和安装命令“gcc-4.2”失败,退出状态为 255的主要内容,如果未能解决你的问题,请参考以下文章
MySqlDb 安装错误:Python 2.6; Mac OS 10.6,已安装 XAMPP
python ubuntu安装Django , MySQLdb 连接数据库 XMAPP
Python - Mysqldb 安装错误 [错误:命令错误退出状态为 1:]