MySQLdb 安装错误 - _mysql.c:44:23: error: my_config.h: No such file or directory

Posted

技术标签:

【中文标题】MySQLdb 安装错误 - _mysql.c:44:23: error: my_config.h: No such file or directory【英文标题】:MySQLdb install error - _mysql.c:44:23: error: my_config.h: No such file or directory 【发布时间】:2012-12-24 01:40:24 【问题描述】:

我正在尝试安装 mysqldb 扩展,但我收到此错误,知道可能是什么原因吗?可能是有权限的东西?我正在使用 Mac OX Lion....

这是错误的一部分。 Django 安装得很好,但我需要安装这个扩展。感谢您的帮助。

ppp-071ca:MySQL-python-1.2.4b4 miguel_e$ sudo python setup.py install
running install
running bdist_egg
running egg_info
writing MySQL_python.egg-info/PKG-INFO
writing top-level names to MySQL_python.egg-info/top_level.txt
writing dependency_links to MySQL_python.egg-info/dependency_links.txt
writing MySQL_python.egg-info/PKG-INFO
writing top-level names to MySQL_python.egg-info/top_level.txt
writing dependency_links to MySQL_python.egg-info/dependency_links.txt
reading manifest file 'MySQL_python.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'MySQL_python.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.7-intel/egg
running install_lib
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.7-intel-2.7/MySQLdb
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,4,'beta',4) -
D__version__=1.2.4b4 -I/Applications/MAMP/Library/include -
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 -g
_mysql.c:44:23: error: my_config.h: No such file or directory
_mysql.c:46:19: error: mysql.h: No such file or directory
_mysql.c:47:26: error: mysqld_error.h: No such file or directory
_mysql.c:48:20: error: errmsg.h: No such file or directory
_mysql.c:88: error: expected specifier-qualifier-list before ‘MYSQL’
_mysql.c:102: error: expected specifier-qualifier-list before ‘MYSQL_RES’
_mysql.c: In function ‘_mysql_Exception’:
_mysql.c:146: warning: implicit declaration of function ‘mysql_errno’
_mysql.c:146: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:149: error: ‘CR_MAX_ERROR’ undeclared (first use in this function)
_mysql.c:149: error: (Each undeclared identifier is reported only once
_mysql.c:149: error: for each function it appears in.)
_mysql.c:161: error: ‘CR_COMMANDS_OUT_OF_SYNC’ undeclared (first use in this function)
_mysql.c:162: error: ‘ER_DB_CREATE_EXISTS’ undeclared (first use in this function)
_mysql.c:163: error: ‘ER_SYNTAX_ERROR’ undeclared (first use in this function)
_mysql.c:164: error: ‘ER_PARSE_ERROR’ undeclared (first use in this function)
_mysql.c:165: error: ‘ER_NO_SUCH_TABLE’ undeclared (first use in this function)
_mysql.c:166: error: ‘ER_WRONG_DB_NAME’ undeclared (first use in this function)
_mysql.c:167: error: ‘ER_WRONG_TABLE_NAME’ undeclared (first use in this function)
_mysql.c:168: error: ‘ER_FIELD_SPECIFIED_TWICE’ undeclared (first use in this function)
_mysql.c:169: error: ‘ER_INVALID_GROUP_FUNC_USE’ undeclared (first use in this function)
_mysql.c:170: error: ‘ER_UNSUPPORTED_EXTENSION’ undeclared (first use in this function)
_mysql.c:171: error: ‘ER_TABLE_MUST_HAVE_COLUMNS’ undeclared (first use in this function)
_mysql.c:200: error: ‘ER_DUP_ENTRY’ undeclared (first use in this function)
_mysql.c:246: warning: implicit declaration of function ‘mysql_error’
_mysql.c:246: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:246: warning: passing argument 1 of ‘PyString_FromString’ makes pointer from    
integer without a cast
_mysql.c: In function ‘_mysql_server_init’:
_mysql.c:351: warning: label ‘finish’ defined but not used
_mysql.c:268: warning: unused variable ‘item’
_mysql.c:267: warning: unused variable ‘groupc’
_mysql.c:267: warning: unused variable ‘i’
_mysql.c:267: warning: unused variable ‘cmd_argc’
_mysql.c:266: warning: unused variable ‘s’
_mysql.c: In function ‘_mysql_ResultObject_Initialize’:
_mysql.c:406: error: ‘MYSQL_RES’ undeclared (first use in this function)
_mysql.c:406: error: ‘result’ undeclared (first use in this function)
_mysql.c:411: error: ‘MYSQL_FIELD’ undeclared (first use in this function)
_mysql.c:411: error: ‘fields’ undeclared (first use in this function)
_mysql.c:425: error: ‘_mysql_ResultObject’ has no member named ‘use’
_mysql.c:428: warning: implicit declaration of function ‘mysql_use_result’
_mysql.c:428: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:430: warning: implicit declaration of function ‘mysql_store_result’
_mysql.c:430: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:431: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:434: warning: implicit declaration of function ‘mysql_field_count’
_mysql.c:434: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:438: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:442: warning: implicit declaration of function ‘mysql_num_fields’
_mysql.c:443: error: ‘_mysql_ResultObject’ has no member named ‘nfields’
_mysql.c:444: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:448: warning: implicit declaration of function ‘mysql_fetch_fields’
_mysql.c:488: error: ‘BINARY_FLAG’ undeclared (first use in this function)
_mysql.c:509: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c: In function ‘_mysql_ResultObject_traverse’:
_mysql.c:523: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:524: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c: In function ‘_mysql_ResultObject_clear’:
_mysql.c:535: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:535: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:535: error: ‘_mysql_ResultObject’ has no member named ‘converger’  
_mysql.c:535: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:536: error: ‘_mysql_ResultObject’ has no member named ‘converger’ 
_mysql.c: In function ‘_mysql_ConnectionObject_Initialize’:
_mysql.c:548: error: ‘MYSQL’ undeclared (first use in this function)
_mysql.c:548: error: ‘conn’ undeclared (first use in this function)
_mysql.c:579: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:580: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:602: error: expected expression before ‘)’ token
_mysql.c:631: warning: implicit declaration of function ‘mysql_init’
_mysql.c:631: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:634: warning: implicit declaration of function ‘mysql_options’
_mysql.c:634: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:634: error: ‘MYSQL_OPT_CONNECT_TIMEOUT’ undeclared (first use in this function)
_mysql.c:645: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:645: error: ‘MYSQL_OPT_COMPRESS’ undeclared (first use in this function)
_mysql.c:646: error: ‘CLIENT_COMPRESS’ undeclared (first use in this function)
_mysql.c:649: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:649: error: ‘MYSQL_OPT_NAMED_PIPE’ undeclared (first use in this function)
_mysql.c:651: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:651: error: ‘MYSQL_INIT_COMMAND’ undeclared (first use in this function)
_mysql.c:653: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:653: error: ‘MYSQL_READ_DEFAULT_FILE’ undeclared (first use in this function)
_mysql.c:655: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:655: error: ‘MYSQL_READ_DEFAULT_GROUP’ undeclared (first use in this function)
_mysql.c:658: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’  
_mysql.c:658: error: ‘MYSQL_OPT_LOCAL_INFILE’ undeclared (first use in this function)
_mysql.c:666: warning: implicit declaration of function ‘mysql_real_connect’
_mysql.c:666: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:684: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:692: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c: In function ‘_mysql_ConnectionObject_traverse’:
_mysql.c:773: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:774: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c: In function ‘_mysql_ConnectionObject_clear’:
_mysql.c:782: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:782: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:782: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:782: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:783: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c: In function ‘_mysql_ConnectionObject_close’:
_mysql.c:798: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:800: warning: implicit declaration of function ‘mysql_close’
_mysql.c:800: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:802: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c: In function ‘_mysql_ConnectionObject_affected_rows’:
_mysql.c:824: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:825: warning: implicit declaration of function ‘mysql_affected_rows’
_mysql.c:825: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_debug’:
_mysql.c:841: warning: implicit declaration of function ‘mysql_debug’
_mysql.c: In function ‘_mysql_ConnectionObject_dump_debug_info’:
_mysql.c:859: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:861: warning: implicit declaration of function ‘mysql_dump_debug_info’
_mysql.c:861: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_autocommit’:
_mysql.c:885: warning: implicit declaration of function ‘mysql_query’
_mysql.c:885: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_commit’:
_mysql.c:908: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_rollback’:
_mysql.c:930: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_errno’:
_mysql.c:1046: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1047: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_error’:
_mysql.c:1062: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1066: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:1066: warning: passing argument 1 of ‘PyString_FromString’ makes pointer from  
integer without a cast
_mysql.c: In function ‘_mysql_escape_string’:
_mysql.c:1099: warning: implicit declaration of function ‘mysql_escape_string’
_mysql.c: In function ‘_mysql_escape’:
_mysql.c:1226: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c: In function ‘_mysql_ResultObject_describe’:
_mysql.c:1306: error: ‘MYSQL_FIELD’ undeclared (first use in this function)
_mysql.c:1306: error: ‘fields’ undeclared (first use in this function)
_mysql.c:1309: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1310: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1311: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1322: warning: implicit declaration of function ‘IS_NOT_NULL’
_mysql.c: In function ‘_mysql_ResultObject_field_flags’:
_mysql.c:1342: error: ‘MYSQL_FIELD’ undeclared (first use in this function)
_mysql.c:1342: error: ‘fields’ undeclared (first use in this function)
_mysql.c:1345: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1346: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1347: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c: At top level:
_mysql.c:1393: error: expected declaration specifiers or ‘...’ before ‘MYSQL_ROW’
_mysql.c: In function ‘_mysql_row_to_tuple’:
_mysql.c:1399: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1401: warning: implicit declaration of function ‘mysql_fetch_lengths’
_mysql.c:1401: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1401: warning: assignment makes pointer from integer without a cast
_mysql.c:1404: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:1405: error: ‘row’ undeclared (first use in this function)
_mysql.c: At top level:
_mysql.c:1418: error: expected declaration specifiers or ‘...’ before ‘MYSQL_ROW’
_mysql.c: In function ‘_mysql_row_to_dict’:
_mysql.c:1423: error: ‘MYSQL_FIELD’ undeclared (first use in this function)
_mysql.c:1423: error: ‘fields’ undeclared (first use in this function)
_mysql.c:1425: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1427: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1427: warning: assignment makes pointer from integer without a cast
_mysql.c:1428: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1431: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:1432: error: ‘row’ undeclared (first use in this function)
_mysql.c: At top level:
_mysql.c:1457: error: expected declaration specifiers or ‘...’ before ‘MYSQL_ROW’
_mysql.c: In function ‘_mysql_row_to_dict_old’:
_mysql.c:1462: error: ‘MYSQL_FIELD’ undeclared (first use in this function)
_mysql.c:1462: error: ‘fields’ undeclared (first use in this function)
_mysql.c:1464: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1466: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1466: warning: assignment makes pointer from integer without a cast
_mysql.c:1467: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1470: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:1471: error: ‘row’ undeclared (first use in this function)
_mysql.c: At top level:
_mysql.c:1493: error: expected declaration specifiers or ‘...’ before ‘MYSQL_ROW’
_mysql.c: In function ‘_mysql__fetch_row’:
_mysql.c:1504: error: ‘MYSQL_ROW’ undeclared (first use in this function)
_mysql.c:1504: error: expected ‘;’ before ‘row’
_mysql.c:1508: error: ‘_mysql_ResultObject’ has no member named ‘use’
_mysql.c:1509: error: ‘row’ undeclared (first use in this function)
_mysql.c:1509: warning: implicit declaration of function ‘mysql_fetch_row’
_mysql.c:1509: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1512: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1515: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:1523: error: too many arguments to function ‘convert_row’
_mysql.c: In function ‘_mysql_ResultObject_fetch_row’:
_mysql.c:1547: error: expected declaration specifiers or ‘...’ before ‘MYSQL_ROW’
_mysql.c:1562: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1574: error: ‘_mysql_ResultObject’ has no member named ‘use’
_mysql.c:1588: warning: implicit declaration of function ‘mysql_num_rows’
_mysql.c:1588: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c: In function ‘_mysql_ConnectionObject_character_set_name’:
_mysql.c:1655: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c: In function ‘_mysql_get_client_info’:
_mysql.c:1766: warning: implicit declaration of function ‘mysql_get_client_info’
_mysql.c:1766: 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:1781: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1785: warning: implicit declaration of function ‘mysql_get_host_info’
_mysql.c:1785: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:1785: 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:1800: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1801: warning: implicit declaration of function ‘mysql_get_proto_info’
_mysql.c:1801: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_get_server_info’:
_mysql.c:1815: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1819: warning: implicit declaration of function ‘mysql_get_server_info’
_mysql.c:1819: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:1819: warning: passing argument 1 of ‘PyString_FromString’ makes pointer from 
integer without a cast
_mysql.c: In function ‘_mysql_ConnectionObject_info’:
_mysql.c:1836: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1837: warning: implicit declaration of function ‘mysql_info’
_mysql.c:1837: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:1837: warning: assignment makes pointer from integer without a cast
_mysql.c: In function ‘_mysql_ConnectionObject_insert_id’:
_mysql.c:1873: error: ‘my_ulonglong’ undeclared (first use in this function)
_mysql.c:1873: error: expected ‘;’ before ‘r’
_mysql.c:1875: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1877: error: ‘r’ undeclared (first use in this function)
_mysql.c:1877: warning: implicit declaration of function ‘mysql_insert_id’
_mysql.c:1877: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_kill’:
_mysql.c:1894: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1896: warning: implicit declaration of function ‘mysql_kill’
_mysql.c:1896: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_field_count’:
_mysql.c:1915: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1917: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ResultObject_num_fields’:
_mysql.c:1932: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1933: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c: In function ‘_mysql_ResultObject_num_rows’:
_mysql.c:1948: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1949: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c: In function ‘_mysql_ConnectionObject_ping’:
_mysql.c:1978: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1979: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:1981: warning: implicit declaration of function ‘mysql_ping’
_mysql.c:1981: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_query’:
_mysql.c:2002: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:2004: warning: implicit declaration of function ‘mysql_real_query’
_mysql.c:2004: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_select_db’:
_mysql.c:2032: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:2034: warning: implicit declaration of function ‘mysql_select_db’
_mysql.c:2034: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_shutdown’:
_mysql.c:2053: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:2055: warning: implicit declaration of function ‘mysql_shutdown’
_mysql.c:2055: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_stat’:
_mysql.c:2080: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:2082: warning: implicit declaration of function ‘mysql_stat’
_mysql.c:2082: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’  
...
...  
_mysql.c: At top level:
_mysql.c:2519: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:2526: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:2533: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:2540: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:2547: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:2610: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:2610: error: initializer element is not constant
_mysql.c:2610: error: (near initialization for ‘_mysql_ResultObject_memberlist[0].offset’)
_mysql.c: In function ‘_mysql_ConnectionObject_getattr’:
_mysql.c:2634: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
lipo: can't open input file: /var/tmp//ccVstRBM.out (No such file or director y)  
error: command 'llvm-gcc-4.2' failed with exit status 1

【问题讨论】:

MacOS X Error when installing python MySQLdb 的可能重复项 【参考方案1】:

通常当您遇到此类错误时,您缺少开发包 - 您需要安装头文件,因为 mysqldb 不附带它们。

我没有亲自在苹果上做过这个,但是这里有一个链接到他们关于如何去做这样的事情的文章。

http://support.apple.com/kb/ht4006

在你安装好源码之后,mysqldb应该可以编译安装没有问题了。

【讨论】:

【参考方案2】:

如果是 ubuntu:apt-get install mysql-devel 如果 centos/rhel : yum install mysql-devel 然后安装 MySQL-python

【讨论】:

找不到包 mysql-devel 尝试 apt-get install mysql-dev 在 19.10 上,这两个 ^^ 包都不可用。 ubuntu 20.04, apt-get 也找不到包【参考方案3】:

我刚刚遇到这个问题。我尝试使用

VCForPython27.msi

解决它。但它不起作用..

我在Github: PyMySQL/mysqlclient-python找到答案,

注意:Windows 版 Wheels 可能不会随源代码包一起发布。您应该在 requirements.txt 中固定版本以避免尝试安装最新的源包。

所以,答案是:指定mysqlclient的版本,使用pip install mysqlclient==1.x.x insdead of

【讨论】:

最初的问题是关于 MacOS,你的解决方案是针对 Windows 的......这看起来不像是对我来说类似问题的答案。【参考方案4】:

我遇到了类似的问题并通过以下方式解决了它:

brew install mysql-client
echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
pip install MySQL-python

【讨论】:

【参考方案5】:

找到here,您需要将my_config.h复制到/usr/include/mysql,然后复制到pip install MySQL-python

【讨论】:

对我有帮助!同一个命令:sudo wget https://raw.githubusercontent.com/paulfitz/mysql-connector-c/master/include/my_config.h -P /usr/include/mysql/ 这对我也有帮助,加上评论使它成为一站式解决方案。这个答案应该在顶部。 在 Ubuntu 20.04 下,pip install MySQL-python 现在可以使用这个 my_config.h - 文件为我工作,但后来我在连接到 mysql 时遇到了问题……对我有用的是:我复制了文件my_config.h 从 ubuntu 18.04 安装到我的 ubuntu 20.04 到 /usr/include/mysql 然后再次 pip install MySQL-python【参考方案6】:

您可以手动将头文件添加到mysql包含目录(从github repo下载):

sudo wget https://raw.githubusercontent.com/paulfitz/mysql-connector-c/master/include/my_config.h -O /usr/include/mysql/my_config.h

重试 pip 安装

sudo pip install MySQL-python

【讨论】:

这是在 Debian 10 中使用 Python 2.7 真正为我工作的唯一解决方案 这也适用于 ubuntu 20.04。蟒蛇2.7【参考方案7】:

请检查这些:

1)libmysqlclient-dev 已安装

2)my_config.h/usr/include/mysql

如果不存在,请在此处找到:

https://dev.mysql.com/doc/dev/mysql-server/8.0.11/my__config_8h_source.html)

【讨论】:

以上是关于MySQLdb 安装错误 - _mysql.c:44:23: error: my_config.h: No such file or directory的主要内容,如果未能解决你的问题,请参考以下文章

python2.7安装MySQLdb

Windows Python2.7 mysqldb安装报错

Django常见错误总结

Python - Mysqldb 安装错误 [错误:命令错误退出状态为 1:]

安装MYSQLdb没有错误,但我无法导入

Python 安装requests和MySQLdb