web-dev-qa-db-ja.com

CentOsにmysql-pythonリターンエラーをインストールします

CentOsでDjangoプロジェクトを実行したい。easy_installとpipでmysql-pythonをインストールしようとしたが、両方でエラーが発生した。問題をグーグルで検索し、いくつかの提案を見つけたが、何もなかった。それらの中で私を助けてくれました。

エラーは次のとおりです。

_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
13
user1724345

最初にpython開発ライブラリをインストールする必要があると思います:

yum install python-devel
37
iabdalkader

ここで終わるかもしれない他の人たちのために言及するだけで、

Python-develをインストールした後、まったく同じエラーが発生しましたが、mysql_config.hがないため、mysql-develのインストールでこのエラーを解決しました。

$ yum install mysql-devel.x86_64 

お役に立てれば

34
jlengrand

私は同様の解決策を見つけました:

yum -y install python-devel mysql-devel
4
Lobo

これを回避する別の方法はyum install python27-MySQL-python.x86_64

1
Peter Lundberg

同じエラーが発生しましたが、理由は異なります(pypy + virtualenv)。

これが私が得たエラーです:

Installing collected packages: mysql-python
  Found existing installation: MySQL-python 1.2.4
    Uninstalling MySQL-python:
      Successfully uninstalled MySQL-python
  Running setup.py install for mysql-python
    building '_mysql' extension
    cc -O2 -fPIC -Wimplicit -Dversion_info=(1,2,4,'final',1) -D__version__=1.2.4 -I/usr/include/mysql -I/mnt/hgfs/Work/devel-centos/include -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -DUNIV_LINUX -DUNIV_LINUX

_mysql.c:29:20: error: Python.h: No such file or directory

include_dir-I/mnt/hgfs/Work/devel-centos/include(つまり、$VIRTUAL_ENV/include)であり、その場所には何もないことに注意してください。

私のセットアップ:

  • CentOS 6.4
  • pypy2.0.2がインストールされています(つまり、python 2.7.3)
  • virtualenv1.10.1をインストールして、

    virtualenv -p /usr/bin/pypy devel-centos

  • python2.6がインストールされています

    yum install python-develは私にとって問題を解決しませんでした。 /usr/lib64/python2.6/ステップでは使用されないpip install mysql-pythonを作成しました。

問題を解決する2つの方法:

  1. 正しいpythonヘッダーファイルをvirtualenvにシンボリックリンクします:

    yum install pypy-devel  # which creates /usr/lib64/pypy-2.0.2/
    ln -s /usr/lib64/pypy-2.0.2/include $VIRTUAL_ENV/include
    
  2. または、setup.cfgファイルをmysql-pythonに変更します

    pip install --no-install mysql-python
    

    次に、$VIRTUAL_ENV/build/mysql-python/setup.cfgを編集します

    [build_ext]
    include_dirs = /usr/lib64/pypy-2.0.2/include
    

    インストールを続行します。

    pip install --no-download mysql-python
    
1
dnozay

同じ問題; Python.hが見つかりません、python-virtualenvがインストールされていないことがわかりました。

yum -y install python-virtualenv
0