Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I want to run a django project on CentOs. I tried to install mysql-python by easy_install and pip but I got error with both of them. I Googled the problem and found some suggestions, but none of them helped me.

errors are:

_mysql.c:29:20: error: Python.h: No such file or directory
_mysql.c:40:26: error: structmember.h: No such file or directory
_mysql.c:74: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:75: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:76: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:77: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:78: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:79: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:80: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:81: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:82: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:83: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:84: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:87: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
_mysql.c:97: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ConnectionObject_Type’
_mysql.c:100: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
_mysql.c:108: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ResultObject_Type’
_mysql.c:127: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:261: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:361: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:379: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:402: error: expected declaration specifiers or ‘...’ before ‘PyObject’
_mysql.c:403: error: expected declaration specifiers or ‘...’ before ‘PyObject’
_mysql.c: In function ‘_mysql_ResultObject_Initialize’:
_mysql.c:405: error: ‘NULL’ undeclared (first use in this function)
_mysql.c:405: error: (Each undeclared identifier is reported only once
_mysql.c:405: error: for each function it appears in.)
_mysql.c:407: warning: initialization from incompatible pointer type
_mysql.c:409: error: ‘PyObject’ undeclared (first use in this function)
_mysql.c:409: error: ‘conv’ undeclared (first use in this function)
_mysql.c:409: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:409: warning: statement with no effect
_mysql.c:413: warning: implicit declaration of function ‘PyArg_ParseTupleAndKeywords’
_mysql.c:413: error: ‘args’ undeclared (first use in this function)
_mysql.c:413: error: ‘kwargs’ undeclared (first use in this function)
_mysql.c:417: warning: implicit declaration of function ‘PyDict_New’
_mysql.c:421: warning: implicit declaration of function ‘Py_INCREF’
_mysql.c:423: error: ‘_mysql_ResultObject’ has no member named ‘conn’
_mysql.c:423: error: expected expression before ‘)’ token
_mysql.c:423: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:423: warning: statement with no effect
_mysql.c:425: error: ‘_mysql_ResultObject’ has no member named ‘use’
_mysql.c:425: warning: statement with no effect
_mysql.c:426: error: ‘Py_BEGIN_ALLOW_THREADS’ undeclared (first use in this function)
_mysql.c:426: warning: statement with no effect
_mysql.c:428: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:428: warning: passing argument 1 of ‘mysql_use_result’ from incompatible pointer type
/usr/include/mysql/mysql.h:401: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’
_mysql.c:430: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:430: warning: passing argument 1 of ‘mysql_store_result’ from incompatible pointer type
/usr/include/mysql/mysql.h:400: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’
_mysql.c:431: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:431: warning: statement with no effect
_mysql.c:432: error: ‘Py_END_ALLOW_THREADS’ undeclared (first use in this function)
_mysql.c:432: warning: statement with no effect
_mysql.c:434: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:434: warning: passing argument 1 of ‘mysql_field_count’ from incompatible pointer type
/usr/include/mysql/mysql.h:368: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’
_mysql.c:435: warning: implicit declaration of function ‘_mysql_Exception’
_mysql.c:438: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:438: warning: implicit declaration of function ‘PyTuple_New’
_mysql.c:438: warning: statement with no effect
_mysql.c:439: warning: implicit declaration of function ‘Py_DECREF’
_mysql.c:443: error: ‘_mysql_ResultObject’ has no member named ‘nfields’
_mysql.c:443: warning: statement with no effect
_mysql.c:444: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:450: error: ‘tmp’ undeclared (first use in this function)
_mysql.c:450: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:450: error: ‘fun’ undeclared (first use in this function)
_mysql.c:450: warning: left-hand operand of comma expression has no effect
_mysql.c:450: warning: statement with no effect
_mysql.c:451: warning: implicit declaration of function ‘PyInt_FromLong’
_mysql.c:451: warning: statement with no effect
_mysql.c:456: warning: implicit declaration of function ‘PyObject_GetItem’
_mysql.c:456: warning: statement with no effect
_mysql.c:459: warning: implicit declaration of function ‘PyErr_Occurred’
_mysql.c:460: warning: implicit declaration of function ‘PyErr_ExceptionMatches’
_mysql.c:460: error: ‘PyExc_KeyError’ undeclared (first use in this function)
_mysql.c:464: warning: implicit declaration of function ‘PyErr_Clear’
_mysql.c:466: error: ‘Py_None’ undeclared (first use in this function)
_mysql.c:466: warning: statement with no effect
_mysql.c:469: warning: implicit declaration of function ‘PySequence_Check’
_mysql.c:470: warning: implicit declaration of function ‘PySequence_Size’
_mysql.c:471: error: ‘fun2’ undeclared (first use in this function)
_mysql.c:471: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:471: warning: statement with no effect
_mysql.c:473: error: ‘t’ undeclared (first use in this function)
_mysql.c:473: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:473: warning: implicit declaration of function ‘PySequence_GetItem’
_mysql.c:473: warning: statement with no effect
_mysql.c:479: warning: implicit declaration of function ‘PyTuple_Check’
_mysql.c:479: warning: implicit declaration of function ‘PyTuple_GET_SIZE’
_mysql.c:481: error: ‘pmask’ undeclared (first use in this function)
_mysql.c:481: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:481: warning: statement with no effect
_mysql.c:482: warning: implicit declaration of function ‘PyTuple_GET_ITEM’
_mysql.c:482: warning: statement with no effect
_mysql.c:483: warning: statement with no effect
_mysql.c:484: warning: implicit declaration of function ‘PyInt_Check’
_mysql.c:485: warning: implicit declaration of function ‘PyInt_AS_LONG’
_mysql.c:495: warning: statement with no effect
_mysql.c:504: warning: statement with no effect
_mysql.c:507: warning: statement with no effect
_mysql.c:509: warning: implicit declaration of function ‘PyTuple_SET_ITEM’
_mysql.c:509: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c: In function ‘_mysql_ResultObject_clear’:
_mysql.c:535: warning: implicit declaration of function ‘Py_XDECREF’
_mysql.c:535: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:536: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:536: error: ‘NULL’ undeclared (first use in this function)
_mysql.c:536: warning: statement with no effect
_mysql.c:537: error: ‘_mysql_ResultObject’ has no member named ‘conn’
_mysql.c:538: error: ‘_mysql_ResultObject’ has no member named ‘conn’
_mysql.c:538: warning: statement with no effect
_mysql.c: At top level:
_mysql.c:545: error: expected declaration specifiers or ‘...’ before ‘PyObject’
_mysql.c:546: error: expected declaration specifiers or ‘...’ before ‘PyObject’
_mysql.c: In function ‘_mysql_ConnectionObject_Initialize’:
_mysql.c:548: error: ‘NULL’ undeclared (first use in this function)
_mysql.c:548: warning: initialization from incompatible pointer type
_mysql.c:549: error: ‘PyObject’ undeclared (first use in this function)
_mysql.c:549: error: ‘conv’ undeclared (first use in this function)
_mysql.c:549: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:549: warning: statement with no effect
_mysql.c:550: error: ‘ssl’ undeclared (first use in this function)
_mysql.c:550: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:550: warning: statement with no effect
_mysql.c:552: warning: initialization from incompatible pointer type
_mysql.c:552: warning: initialization from incompatible pointer type
_mysql.c:552: warning: initialization from incompatible pointer type
_mysql.c:553: warning: initialization from incompatible pointer type
_mysql.c:553: warning: initialization from incompatible pointer type
_mysql.c:555: warning: initialization from incompatible pointer type
_mysql.c:555: warning: initialization from incompatible pointer type
_mysql.c:555: warning: initialization from incompatible pointer type
_mysql.c:556: warning: initialization from incompatible pointer type
_mysql.c:556: warning: initialization from incompatible pointer type
_mysql.c:569: error: initializer element is not constant
_mysql.c:569: error: (near initialization for ‘kwlist[17]’)
_mysql.c:575: warning: initialization from incompatible pointer type
_mysql.c:576: warning: initialization from incompatible pointer type
_mysql.c:577: warning: initialization from incompatible pointer type
_mysql.c:579: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:579: warning: statement with no effect
_mysql.c:580: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:580: warning: statement with no effect
_mysql.c:583: error: ‘args’ undeclared (first use in this function)
_mysql.c:583: error: ‘kwargs’ undeclared (first use in this function)
_mysql.c:616: error: ‘value’ undeclared (first use in this function)
_mysql.c:616: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:616: warning: statement with no effect
_mysql.c:617: warning: implicit declaration of function ‘PyMapping_GetItemString’
_mysql.c:617: warning: statement with no effect
_mysql.c:617: warning: implicit declaration of function ‘PyString_AsString’
_mysql.c:617: warning: assignment makes pointer from integer without a cast
_mysql.c:618: warning: statement with no effect
_mysql.c:618: warning: assignment makes pointer from integer without a cast
_mysql.c:619: warning: statement with no effect
_mysql.c:619: warning: assignment makes pointer from integer without a cast
_mysql.c:620: warning: statement with no effect
_mysql.c:620: warning: assignment makes pointer from integer without a cast
_mysql.c:621: warning: statement with no effect
_mysql.c:621: warning: assignment makes pointer from integer without a cast
_mysql.c:629: error: ‘Py_BEGIN_ALLOW_THREADS’ undeclared (first use in this function)
_mysql.c:629: warning: statement with no effect
_mysql.c:630: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:630: warning: passing argument 1 of ‘mysql_init’ from incompatible pointer type
/usr/include/mysql/mysql.h:380: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’
_mysql.c:633: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:634: warning: passing argument 1 of ‘mysql_options’ from incompatible pointer type
/usr/include/mysql/mysql.h:445: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’
_mysql.c:639: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:640: warning: passing argument 1 of ‘mysql_options’ from incompatible pointer type
/usr/include/mysql/mysql.h:445: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’
_mysql.c:644: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:644: warning: passing argument 1 of ‘mysql_options’ from incompatible pointer type
/usr/include/mysql/mysql.h:445: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’
_mysql.c:648: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:648: warning: passing argument 1 of ‘mysql_options’ from incompatible pointer type
/usr/include/mysql/mysql.h:445: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’
_mysql.c:649: warning: comparison of distinct pointer types lacks a cast
_mysql.c:650: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:650: warning: passing argument 1 of ‘mysql_options’ from incompatible pointer type
/usr/include/mysql/mysql.h:445: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’
_mysql.c:651: warning: comparison of distinct pointer types lacks a cast
_mysql.c:652: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:652: warning: passing argument 1 of ‘mysql_options’ from incompatible pointer type
/usr/include/mysql/mysql.h:445: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’
_mysql.c:653: warning: comparison of distinct pointer types lacks a cast
_mysql.c:654: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:654: warning: passing argument 1 of ‘mysql_options’ from incompatible pointer type
/usr/include/mysql/mysql.h:445: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’
_mysql.c:657: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:657: warning: passing argument 1 of ‘mysql_options’ from incompatible pointer type
/usr/include/mysql/mysql.h:445: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’
_mysql.c:661: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:662: warning: passing argument 1 of ‘mysql_ssl_set’ from incompatible pointer type
/usr/include/mysql/mysql.h:381: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’
_mysql.c:665: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:666: warning: passing argument 1 of ‘mysql_real_connect’ from incompatible pointer type
/usr/include/mysql/mysql.h:387: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’
_mysql.c:668: error: ‘Py_END_ALLOW_THREADS’ undeclared (first use in this function)
_mysql.c:668: warning: statement with no effect
_mysql.c:677: warning: statement with no effect
_mysql.c:683: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:683: warning: statement with no effect
_mysql.c:691: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:691: warning: statement with no effect
_mysql.c: At top level:
_mysql.c:749: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c: In function ‘_mysql_ConnectionObject_clear’:
_mysql.c:781: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:782: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:782: error: ‘NULL’ undeclared (first use in this function)
_mysql.c:782: warning: statement with no effect
_mysql.c: At top level:
_mysql.c:789: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:817: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:833: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:851: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:870: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:896: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:918: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:950: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:976: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1003: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1022: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1039: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1055: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1077: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1124: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1167: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1169: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1203: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1233: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1267: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1299: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1335: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1359: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1389: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1414: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1453: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1492: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1497: error: expected declaration specifiers or ‘...’ before ‘PyObject’
_mysql.c:1500: error: expected declaration specifiers or ‘...’ before ‘_PYFUNC’
_mysql.c: In function ‘_mysql__fetch_row’:
_mysql.c:1506: error: ‘PyObject’ undeclared (first use in this function)
_mysql.c:1506: error: ‘v’ undeclared (first use in this function)
_mysql.c:1506: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:1506: warning: statement with no effect
_mysql.c:1507: error: ‘_mysql_ResultObject’ has no member named ‘use’
_mysql.c:1508: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1508: warning: passing argument 1 of ‘mysql_fetch_row’ from incompatible pointer type
/usr/include/mysql/mysql.h:454: note: expected ‘struct MYSQL_RES *’ but argument is of type ‘char **’
_mysql.c:1510: error: ‘Py_BEGIN_ALLOW_THREADS’ undeclared (first use in this function)
_mysql.c:1510: warning: statement with no effect
_mysql.c:1511: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1511: warning: passing argument 1 of ‘mysql_fetch_row’ from incompatible pointer type
/usr/include/mysql/mysql.h:454: note: expected ‘struct MYSQL_RES *’ but argument is of type ‘char **’
_mysql.c:1512: error: ‘Py_END_ALLOW_THREADS’ undeclared (first use in this function)
_mysql.c:1512: warning: statement with no effect
_mysql.c:1514: error: ‘_mysql_ResultObject’ has no member named ‘conn’
_mysql.c:1514: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:1514: warning: passing argument 1 of ‘mysql_errno’ from incompatible pointer type
/usr/include/mysql/mysql.h:371: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’
_mysql.c:1515: error: ‘_mysql_ResultObject’ has no member named ‘conn’
_mysql.c:1519: warning: implicit declaration of function ‘_PyTuple_Resize’
_mysql.c:1519: error: ‘r’ undeclared (first use in this function)
_mysql.c:1522: warning: implicit declaration of function ‘convert_row’
_mysql.c:1522: warning: statement with no effect
_mysql.c: At top level:
_mysql.c:1540: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1619: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1647: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1673: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1713: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1755: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1774: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1793: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1808: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1828: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1867: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1885: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1908: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1925: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1941: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1970: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:1993: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:2023: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:2045: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:2072: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:2098: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:2139: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:2159: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c: In function ‘_mysql_ConnectionObject_dealloc’:
_mysql.c:2193: error: ‘PyObject’ undeclared (first use in this function)
_mysql.c:2193: error: ‘o’ undeclared (first use in this function)
_mysql.c:2193: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
_mysql.c:2193: warning: statement with no effect
_mysql.c:2196: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:2197: warning: implicit declaration of function ‘_mysql_ConnectionObject_close’
_mysql.c:2197: error: ‘NULL’ undeclared (first use in this function)
_mysql.c:2197: warning: statement with no effect
_mysql.c:2200: warning: implicit declaration of function ‘PyMem_Free’
_mysql.c: At top level:
_mysql.c:2203: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:2224: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:2239: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:2261: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c: In function ‘_mysql_ResultObject_dealloc’:
_mysql.c:2283: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:2283: warning: passing argument 1 of ‘mysql_free_result’ from incompatible pointer type
/usr/include/mysql/mysql.h:447: note: expected ‘struct MYSQL_RES *’ but argument is of type ‘char **’
_mysql.c: At top level:
_mysql.c:2288: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:2302: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ConnectionObject_methods’
_mysql.c:2517: error: array type has incomplete element type
_mysql.c:2518: error: ‘T_INT’ undeclared here (not in a function)
_mysql.c:2518: warning: implicit declaration of function ‘offsetof’
_mysql.c:2518: error: expected expression before ‘_mysql_ConnectionObject’
_mysql.c:2518: error: ‘READONLY’ undeclared here (not in a function)
_mysql.c:2525: error: ‘T_OBJECT’ undeclared here (not in a function)
_mysql.c:2525: error: expected expression before ‘_mysql_ConnectionObject’
_mysql.c:2532: error: ‘T_UINT’ undeclared here (not in a function)
_mysql.c:2532: error: expected expression before ‘_mysql_ConnectionObject’
_mysql.c:2539: error: expected expression before ‘_mysql_ConnectionObject’
_mysql.c:2546: error: expected expression before ‘_mysql_ConnectionObject’
_mysql.c:2553: error: ‘NULL’ undeclared here (not in a function)
_mysql.c:2556: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ResultObject_methods’
_mysql.c:2608: error: array type has incomplete element type
_mysql.c:2609: error: expected expression before ‘_mysql_ResultObject’
_mysql.c:2619: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:2649: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:2681: error: expected declaration specifiers or ‘...’ before ‘PyObject’
_mysql.c: In function ‘_mysql_ConnectionObject_setattr’:
_mysql.c:2683: error: ‘v’ undeclared (first use in this function)
_mysql.c:2684: warning: implicit declaration of function ‘PyErr_SetString’
_mysql.c:2684: error: ‘PyExc_AttributeError’ undeclared (first use in this function)
_mysql.c:2689: warning: implicit declaration of function ‘PyMember_Set’
_mysql.c: At top level:
_mysql.c:2706: error: expected declaration specifiers or ‘...’ before ‘PyObject’
_mysql.c: In function ‘_mysql_ResultObject_setattr’:
_mysql.c:2708: error: ‘v’ undeclared (first use in this function)
_mysql.c:2709: error: ‘PyExc_AttributeError’ undeclared (first use in this function)
_mysql.c: At top level:
_mysql.c:2727: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ConnectionObject_Type’
_mysql.c:2815: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ResultObject_Type’
_mysql.c:2905: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_methods’
_mysql.c:2977: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_mysql.c:3022: warning: return type defaults to ‘int’
_mysql.c: In function ‘DL_EXPORT’:
_mysql.c:3022: error: expected declaration specifiers before ‘init_mysql’
_mysql.c:3130: error: expected ‘{’ at end of input
error: Setup script exited with error: command 'gcc' failed with exit status 1
share|improve this question
I'm afraid you'll probably have as much luck here as with google if you dont tell us what you tried. Can you tell us what you tried? – Sheena Oct 24 '12 at 7:12
In Debian we have a package : python-dev, containing the Python header files. I think this is what you are missing. Also add more information about what you have tried before. – pistache Oct 24 '12 at 7:14

2 Answers

up vote 7 down vote accepted

I think you need to install the python development libraries first:

yum install python-devel
share|improve this answer
This is so simple yet fixed my issue. :) Thank you very much – Lee Dec 9 '12 at 14:54
1  
And in the off-chance that you came here looking for a similar solution for Ubuntu instead of CentOS, just use apt-get install python-dev – Nick Ruiz Mar 11 at 19:55
And in case you have installed python2.7 into your environment, the appropriate command is: yum install python27-devel. – DuffJ May 9 at 11:27

Just to mention for the others that might end up here too,

After installing pyython-devel, I had the very same error but with mysql_config.h missing I solved this error in installing mysql-devel

$ yum install mysql-devel.x86_64 

Hope this helps

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.