解决:centos安装python-mysql出错

_mysql.c:760: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c: In function ‘_mysql_ConnectionObject_clear’:

_mysql.c:792: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’

_mysql.c:793: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’

_mysql.c:793: error: ‘NULL’ undeclared (first use in this function)

_mysql.c:793: warning: statement with no effect

_mysql.c: At top level:

_mysql.c:800: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:828: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:844: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:862: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:881: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:907: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:921: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:943: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:975: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1064: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1080: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1102: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1149: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1192: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1194: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1230: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1260: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1294: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1326: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1362: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1386: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1416: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1441: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1480: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1519: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1524: error: expected declaration specifiers or ‘...’ before ‘PyObject’

_mysql.c:1527: error: expected declaration specifiers or ‘...’ before ‘_PYFUNC’

_mysql.c: In function ‘_mysql__fetch_row’:

_mysql.c:1530: error: ‘MYSQL_ROW’ undeclared (first use in this function)

_mysql.c:1530: warning: statement with no effect

_mysql.c:1530: error: expected ‘;’ before ‘row’

_mysql.c:1533: error: ‘PyObject’ undeclared (first use in this function)

_mysql.c:1533: error: ‘v’ undeclared (first use in this function)

_mysql.c:1533: error: invalid operands to binary * (have ‘char **’ and ‘char **’)

_mysql.c:1533: warning: statement with no effect

_mysql.c:1534: error: ‘_mysql_ResultObject’ has no member named ‘use’

_mysql.c:1535: error: ‘row’ undeclared (first use in this function)

_mysql.c:1535: warning: implicit declaration of function ‘mysql_fetch_row’

_mysql.c:1535: error: ‘_mysql_ResultObject’ has no member named ‘result’

_mysql.c:1535: warning: statement with no effect

_mysql.c:1537: error: ‘Py_BEGIN_ALLOW_THREADS’ undeclared (first use in this function)

_mysql.c:1537: warning: statement with no effect

_mysql.c:1538: error: ‘_mysql_ResultObject’ has no member named ‘result’

_mysql.c:1538: warning: statement with no effect

_mysql.c:1539: error: ‘Py_END_ALLOW_THREADS’ undeclared (first use in this function)

_mysql.c:1539: warning: statement with no effect

_mysql.c:1541: warning: implicit declaration of function ‘mysql_errno’

_mysql.c:1541: error: ‘_mysql_ResultObject’ has no member named ‘conn’

_mysql.c:1541: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’

_mysql.c:1542: error: ‘_mysql_ResultObject’ has no member named ‘conn’

_mysql.c:1546: warning: implicit declaration of function ‘_PyTuple_Resize’

_mysql.c:1546: error: ‘r’ undeclared (first use in this function)

_mysql.c:1549: warning: implicit declaration of function ‘convert_row’

_mysql.c:1549: warning: statement with no effect

_mysql.c: At top level:

_mysql.c:1567: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1674: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1782: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1801: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1820: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1835: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1855: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1894: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1912: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1935: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1952: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1968: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:1997: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:2020: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:2050: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:2072: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:2099: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:2125: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:2166: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:2186: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c: In function ‘_mysql_ConnectionObject_dealloc’:

_mysql.c:2220: error: ‘PyObject’ undeclared (first use in this function)

_mysql.c:2220: error: ‘o’ undeclared (first use in this function)

_mysql.c:2220: error: invalid operands to binary * (have ‘char **’ and ‘char **’)

_mysql.c:2220: warning: statement with no effect

_mysql.c:2223: error: ‘_mysql_ConnectionObject’ has no member named ‘open’

_mysql.c:2224: warning: implicit declaration of function ‘_mysql_ConnectionObject_close’

_mysql.c:2224: error: ‘NULL’ undeclared (first use in this function)

_mysql.c:2224: warning: statement with no effect

_mysql.c:2227: warning: implicit declaration of function ‘PyMem_Free’

_mysql.c: At top level:

_mysql.c:2230: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:2251: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:2266: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:2288: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c: In function ‘_mysql_ResultObject_dealloc’:

_mysql.c:2310: warning: implicit declaration of function ‘mysql_free_result’

_mysql.c:2310: error: ‘_mysql_ResultObject’ has no member named ‘result’

_mysql.c: At top level:

_mysql.c:2315: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:2329: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ConnectionObject_methods’

_mysql.c:2550: error: array type has incomplete element type

_mysql.c:2551: error: ‘T_INT’ undeclared here (not in a function)

_mysql.c:2551: warning: implicit declaration of function ‘offsetof’

_mysql.c:2551: error: expected expression before ‘_mysql_ConnectionObject’

_mysql.c:2551: error: ‘READONLY’ undeclared here (not in a function)

_mysql.c:2558: error: ‘T_OBJECT’ undeclared here (not in a function)

_mysql.c:2558: error: expected expression before ‘_mysql_ConnectionObject’

_mysql.c:2565: error: ‘T_UINT’ undeclared here (not in a function)

_mysql.c:2565: error: expected expression before ‘_mysql_ConnectionObject’

_mysql.c:2572: error: expected expression before ‘_mysql_ConnectionObject’

_mysql.c:2579: error: expected expression before ‘_mysql_ConnectionObject’

_mysql.c:2586: error: ‘NULL’ undeclared here (not in a function)

_mysql.c:2589: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ResultObject_methods’

_mysql.c:2641: error: array type has incomplete element type

_mysql.c:2642: error: expected expression before ‘_mysql_ResultObject’

_mysql.c:2652: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:2682: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:2714: error: expected declaration specifiers or ‘...’ before ‘PyObject’

_mysql.c: In function ‘_mysql_ConnectionObject_setattr’:

_mysql.c:2716: error: ‘v’ undeclared (first use in this function)

_mysql.c:2717: error: ‘PyExc_AttributeError’ undeclared (first use in this function)

_mysql.c:2722: warning: implicit declaration of function ‘PyMember_Set’

_mysql.c: At top level:

_mysql.c:2739: error: expected declaration specifiers or ‘...’ before ‘PyObject’

_mysql.c: In function ‘_mysql_ResultObject_setattr’:

_mysql.c:2741: error: ‘v’ undeclared (first use in this function)

_mysql.c:2742: error: ‘PyExc_AttributeError’ undeclared (first use in this function)

_mysql.c: At top level:

_mysql.c:2760: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ConnectionObject_Type’

_mysql.c:2848: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ResultObject_Type’

_mysql.c:2938: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_methods’

_mysql.c:3010: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

_mysql.c:3058: warning: return type defaults to ‘int’

_mysql.c: In function ‘DL_EXPORT’:

_mysql.c:3058: error: expected declaration specifiers before ‘init_mysql’

_mysql.c:3166: error: expected ‘{’ at end of input

error: command 'gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/MySQL-Python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-nuQKPM-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/MySQL-Python
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
  File "/usr/lib/python2.6/site-packages/pip-1.5.4-py2.6.egg/pip/__init__.py", line 185, in main
    return command.main(cmd_args)
  File "/usr/lib/python2.6/site-packages/pip-1.5.4-py2.6.egg/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 33: ordinal not in range(128)‘’‘

 

解决方法:

在安装mysql-python之前先安装库文件:

yum install python-devel mysql-devel zlib-devel openssl-devel

posted on 2017-02-04 18:17  野区杰西  阅读(672)  评论(0)    收藏  举报

导航