我在为 Python 安装 MySQL 时出现此错误。
running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-i686-2.6/MySQLdb
running build_ext building '_mysql' extension gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/include/mysql -I/usr/include/python2.6 -c _mysql.c -o build/temp.linux-i686-2.6/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -fasynchronous-unwind-tables -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -DUNIV_LINUX
unable to execute gcc:
No such file or directory error:
command 'gcc' failed with exit status 1
我发出了这个命令:
python setup.py install
我从这里。
编辑
安装 gcc 后出现如下信息:
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
reading manifest file 'MySQL_python.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
writing manifest file 'MySQL_python.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-i686/egg
running install_lib
running build_py
copying MySQLdb/release.py -> build/lib.linux-i686-2.6/MySQLdb
running build_ext
building '_mysql' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/include/mysql -I/usr/include/python2.6 -c _mysql.c -o build/temp.linux-i686-2.6/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -fasynchronous-unwind-tables -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -DUNIV_LINUX
In file included from _mysql.c:29:
pymemcompat.h:10:20: error: Python.h: No such file or directory
_mysql.c:30:26: error: structmember.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:62: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:63: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:64: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:65: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:66: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:67: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:68: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:69: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:70: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:71: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:72: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:75: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
_mysql.c:85: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ConnectionObject_Type’
_mysql.c:88: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
_mysql.c:96: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ResultObject_Type’
_mysql.c:105: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:227: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:318: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:359: error: expected declaration specifiers or ‘...’ before ‘PyObject’
_mysql.c:360: error: expected declaration specifiers or ‘...’ before ‘PyObject’
_mysql.c: In function ‘_mysql_ResultObject_Initialize’:
_mysql.c:362: error: ‘NULL’ undeclared (first use in this function)
_mysql.c:362: error: (Each undeclared identifier is reported only once
_mysql.c:362: error: for each function it appears in.)
_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:363: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:363: warning: statement with no effect
_mysql.c:364: warning: initialization from incompatible pointer type
_mysql.c:366: error: ‘PyObject’ undeclared (first use in this function)
_mysql.c:366: error: ‘conv’ undeclared (first use in this function)
_mysql.c:366: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:366: warning: statement with no effect
_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:368: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:368: warning: statement with no effect
_mysql.c:370: warning: implicit declaration of function ‘PyArg_ParseTupleAndKeywords’
_mysql.c:370: error: ‘args’ undeclared (first use in this function)
_mysql.c:370: error: ‘kwargs’ undeclared (first use in this function)
_mysql.c:373: warning: implicit declaration of function ‘PyDict_New’
_mysql.c:373: warning: statement with no effect
_mysql.c:375: error: ‘_mysql_ResultObject’ has no member named ‘conn’
_mysql.c:375: error: expected expression before ‘)’ token
_mysql.c:375: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:375: warning: statement with no effect
_mysql.c:376: warning: implicit declaration of function ‘Py_INCREF’
_mysql.c:377: error: ‘_mysql_ResultObject’ has no member named ‘use’
_mysql.c:377: warning: statement with no effect
_mysql.c:378: error: ‘Py_BEGIN_ALLOW_THREADS’ undeclared (first use in this function)
_mysql.c:378: warning: statement with no effect
_mysql.c:380: warning: implicit declaration of function ‘mysql_use_result’
_mysql.c:380: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:380: warning: statement with no effect
_mysql.c:382: warning: implicit declaration of function ‘mysql_store_result’
_mysql.c:382: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:382: warning: statement with no effect
_mysql.c:383: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:383: warning: statement with no effect
_mysql.c:384: error: ‘Py_END_ALLOW_THREADS’ undeclared (first use in this function)
_mysql.c:384: warning: statement with no effect
_mysql.c:386: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:386: warning: implicit declaration of function ‘PyTuple_New’
_mysql.c:386: warning: statement with no effect
_mysql.c:389: warning: implicit declaration of function ‘mysql_num_fields’
_mysql.c:390: error: ‘_mysql_ResultObject’ has no member named ‘nfields’
_mysql.c:390: warning: statement with no effect
_mysql.c:391: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:392: warning: implicit declaration of function ‘mysql_fetch_fields’
_mysql.c:392: warning: statement with no effect
_mysql.c:394: error: ‘tmp’ undeclared (first use in this function)
_mysql.c:394: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:394: error: ‘fun’ undeclared (first use in this function)
_mysql.c:394: warning: left-hand operand of comma expression has no effect
_mysql.c:394: warning: statement with no effect
_mysql.c:395: warning: implicit declaration of function ‘PyInt_FromLong’
_mysql.c:395: error: request for member ‘type’ in something not a structure or union
_mysql.c:395: warning: statement with no effect
_mysql.c:397: warning: implicit declaration of function ‘PyObject_GetItem’
_mysql.c:397: warning: statement with no effect
_mysql.c:398: warning: implicit declaration of function ‘Py_DECREF’
_mysql.c:400: warning: implicit declaration of function ‘PyErr_Clear’
_mysql.c:401: error: ‘Py_None’ undeclared (first use in this function)
_mysql.c:401: warning: statement with no effect
_mysql.c:404: warning: implicit declaration of function ‘PySequence_Check’
_mysql.c:405: warning: implicit declaration of function ‘PySequence_Size’
_mysql.c:406: error: ‘fun2’ undeclared (first use in this function)
_mysql.c:406: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:406: warning: statement with no effect
_mysql.c:408: error: ‘t’ undeclared (first use in this function)
_mysql.c:408: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:408: warning: implicit declaration of function ‘PySequence_GetItem’
_mysql.c:408: warning: statement with no effect
_mysql.c:410: warning: implicit declaration of function ‘PyTuple_Check’
_mysql.c:411: warning: implicit declaration of function ‘PyTuple_GET_SIZE’
_mysql.c:413: error: ‘pmask’ undeclared (first use in this function)
_mysql.c:413: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:413: warning: statement with no effect
_mysql.c:414: warning: implicit declaration of function ‘PyTuple_GET_ITEM’
_mysql.c:414: warning: statement with no effect
_mysql.c:415: warning: statement with no effect
_mysql.c:416: warning: implicit declaration of function ‘PyInt_Check’
_mysql.c:417: warning: implicit declaration of function ‘PyInt_AS_LONG’
_mysql.c:418: error: request for member ‘flags’ in something not a structure or union
_mysql.c:418: error: invalid operands to binary & (have ‘long int’ and ‘char **’)
_mysql.c:433: warning: statement with no effect
_mysql.c:436: warning: statement with no effect
_mysql.c:438: warning: implicit declaration of function ‘PyTuple_SET_ITEM’
_mysql.c:438: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c: In function ‘_mysql_ResultObject_clear’:
_mysql.c:462: warning: implicit declaration of function ‘Py_XDECREF’
_mysql.c:462: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:463: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:463: error: ‘NULL’ undeclared (first use in this function)
_mysql.c:463: warning: statement with no effect
_mysql.c:464: error: ‘_mysql_ResultObject’ has no member named ‘conn’
_mysql.c:465: error: ‘_mysql_ResultObject’ has no member named ‘conn’
_mysql.c:465: warning: statement with no effect
_mysql.c: At top level:
_mysql.c:472: error: expected declaration specifiers or ‘...’ before ‘PyObject’
_mysql.c:473: error: expected declaration specifiers or ‘...’ before ‘PyObject’
_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:475: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:475: error: ‘NULL’ undeclared (first use in this function)
_mysql.c:475: warning: statement with no effect
_mysql.c:476: error: ‘PyObject’ undeclared (first use in this function)
_mysql.c:476: error: ‘conv’ undeclared (first use in this function)
_mysql.c:476: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:476: warning: statement with no effect
_mysql.c:477: error: ‘ssl’ undeclared (first use in this function)
_mysql.c:477: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:477: warning: statement with no effect
_mysql.c:482: warning: initialization from incompatible pointer type
_mysql.c:482: warning: initialization from incompatible pointer type
_mysql.c:482: warning: initialization from incompatible pointer type
_mysql.c:483: warning: initialization from incompatible pointer type
_mysql.c:483: warning: initialization from incompatible pointer type
_mysql.c:493: error: initializer element is not constant
_mysql.c:493: error: (near initialization for ‘kwlist[16]’)
_mysql.c:496: warning: initialization from incompatible pointer type
_mysql.c:497: warning: initialization from incompatible pointer type
_mysql.c:498: warning: initialization from incompatible pointer type
_mysql.c:500: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:500: warning: statement with no effect
_mysql.c:501: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:501: warning: statement with no effect
_mysql.c:503: error: ‘args’ undeclared (first use in this function)
_mysql.c:503: error: ‘kwargs’ undeclared (first use in this function)
_mysql.c:530: warning: implicit declaration of function ‘PyErr_SetString’
_mysql.c:530: error: ‘_mysql_NotSupportedError’ undeclared (first use in this function)
_mysql.c:536: error: ‘Py_BEGIN_ALLOW_THREADS’ undeclared (first use in this function)
_mysql.c:536: warning: statement with no effect
_mysql.c:537: warning: implicit declaration of function ‘mysql_init’
_mysql.c:537: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:537: warning: statement with no effect
_mysql.c:540: warning: implicit declaration of function ‘mysql_options’
_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:545: error: invalid operands to binary | (have ‘unsigned int’ and ‘char **’)
_mysql.c:545: warning: statement with no effect
_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:549: warning: comparison of distinct pointer types lacks a cast
_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:551: warning: comparison of distinct pointer types lacks a cast
_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:553: warning: comparison of distinct pointer types lacks a cast
_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: warning: implicit declaration of function ‘mysql_real_connect’
_mysql.c:565: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:566: warning: statement with no effect
_mysql.c:568: error: ‘Py_END_ALLOW_THREADS’ undeclared (first use in this function)
_mysql.c:568: warning: statement with no effect
_mysql.c:571: warning: implicit declaration of function ‘_mysql_Exception’
_mysql.c:577: warning: statement with no effect
_mysql.c:583: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:583: warning: statement with no effect
_mysql.c:591: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:591: warning: statement with no effect
_mysql.c: At top level:
_mysql.c:649: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c: In function ‘_mysql_ConnectionObject_clear’:
_mysql.c:681: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:682: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:682: error: ‘NULL’ undeclared (first use in this function)
_mysql.c:682: warning: statement with no effect
_mysql.c: At top level:
_mysql.c:689: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:717: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:733: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:751: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:770: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:796: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:818: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:850: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:935: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:951: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:969: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1004: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1035: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1037: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1067: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1097: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1131: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1163: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1199: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1223: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1248: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1273: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1312: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1351: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1356: error: expected declaration specifiers or ‘...’ before ‘PyObject’
_mysql.c:1359: error: expected declaration specifiers or ‘...’ before ‘_PYFUNC’
_mysql.c: In function ‘_mysql__fetch_row’:
_mysql.c:1362: error: ‘MYSQL_ROW’ undeclared (first use in this function)
_mysql.c:1362: warning: statement with no effect
_mysql.c:1362: error: expected ‘;’ before ‘row’
_mysql.c:1365: error: ‘PyObject’ undeclared (first use in this function)
_mysql.c:1365: error: ‘v’ undeclared (first use in this function)
_mysql.c:1365: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:1365: warning: statement with no effect
_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: warning: implicit declaration of function ‘mysql_fetch_row’
_mysql.c:1367: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1367: warning: statement with no effect
_mysql.c:1369: error: ‘Py_BEGIN_ALLOW_THREADS’ undeclared (first use in this function)
_mysql.c:1369: warning: statement with no effect
_mysql.c:1370: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1370: warning: statement with no effect
_mysql.c:1371: error: ‘Py_END_ALLOW_THREADS’ undeclared (first use in this function)
_mysql.c:1371: warning: statement with no effect
_mysql.c:1373: warning: implicit declaration of function ‘mysql_errno’
_mysql.c:1373: error: ‘_mysql_ResultObject’ has no member named ‘conn’
_mysql.c:1373: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:1374: error: ‘_mysql_ResultObject’ has no member named ‘conn’
_mysql.c:1378: warning: implicit declaration of function ‘_PyTuple_Resize’
_mysql.c:1378: error: ‘r’ undeclared (first use in this function)
_mysql.c:1381: warning: implicit declaration of function ‘convert_row’
_mysql.c:1381: warning: statement with no effect
_mysql.c: At top level:
_mysql.c:1399: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1506: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1597: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1612: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1627: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1642: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1658: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1693: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1711: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1734: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1751: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1767: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1796: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1819: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1849: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1871: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1898: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1919: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1960: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1980: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c: In function ‘_mysql_ConnectionObject_dealloc’:
_mysql.c:2014: error: ‘PyObject’ undeclared (first use in this function)
_mysql.c:2014: error: ‘o’ undeclared (first use in this function)
_mysql.c:2014: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:2014: warning: statement with no effect
_mysql.c:2017: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:2018: warning: implicit declaration of function ‘_mysql_ConnectionObject_close’
_mysql.c:2018: error: ‘NULL’ undeclared (first use in this function)
_mysql.c:2018: warning: statement with no effect
_mysql.c:2021: warning: implicit declaration of function ‘PyMem_Free’
_mysql.c: At top level:
_mysql.c:2024: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:2041: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:2056: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:2078: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_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:2105: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:2115: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ConnectionObject_methods’
_mysql.c:2330: error: array type has incomplete element type
_mysql.c:2331: error: ‘T_INT’ undeclared here (not in a function)
_mysql.c:2331: warning: implicit declaration of function ‘offsetof’
_mysql.c:2331: error: expected expression before ‘_mysql_ConnectionObject’
_mysql.c:2331: error: ‘RO’ undeclared here (not in a function)
_mysql.c:2338: error: ‘T_OBJECT’ undeclared here (not in a function)
_mysql.c:2338: error: expected expression before ‘_mysql_ConnectionObject’
_mysql.c:2345: error: ‘T_UINT’ undeclared here (not in a function)
_mysql.c:2345: error: expected expression before ‘_mysql_ConnectionObject’
_mysql.c:2352: error: expected expression before ‘_mysql_ConnectionObject’
_mysql.c:2359: error: expected expression before ‘_mysql_ConnectionObject’
_mysql.c:2366: error: ‘NULL’ undeclared here (not in a function)
_mysql.c:2369: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ResultObject_methods’
_mysql.c:2421: error: array type has incomplete element type
_mysql.c:2422: error: expected expression before ‘_mysql_ResultObject’
_mysql.c:2432: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:2460: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:2490: error: expected declaration specifiers or ‘...’ before ‘PyObject’
_mysql.c: In function ‘_mysql_ConnectionObject_setattr’:
_mysql.c:2492: error: ‘v’ undeclared (first use in this function)
_mysql.c:2493: error: ‘PyExc_AttributeError’ undeclared (first use in this function)
_mysql.c:2498: warning: implicit declaration of function ‘PyMember_Set’
_mysql.c: At top level:
_mysql.c:2515: error: expected declaration specifiers or ‘...’ before ‘PyObject’
_mysql.c: In function ‘_mysql_ResultObject_setattr’:
_mysql.c:2517: error: ‘v’ undeclared (first use in this function)
_mysql.c:2518: error: ‘PyExc_AttributeError’ undeclared (first use in this function)
_mysql.c: At top level:
_mysql.c:2536: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ConnectionObject_Type’
_mysql.c:2620: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ResultObject_Type’
_mysql.c:2706: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_methods’
_mysql.c:2778: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:2810: warning: return type defaults to ‘int’
_mysql.c: In function ‘DL_EXPORT’:
_mysql.c:2810: error: expected declaration specifiers before ‘init_mysql’
_mysql.c:2888: error: expected ‘{’ at end of input
error: command 'gcc' failed with exit status 1
答案1
pymemcompat.h:10:20: error: Python.h: No such file or directory
您缺少 Python 开发头文件包(在 Debian 上称为 python-dev,不记得在 CentOS 上它是什么)
答案2
无法执行 gcc:没有此文件或目录错误:命令‘gcc’失败,退出状态为 1
这是你的问题,你没有安装 gcc。安装 gcc 然后再试一次