您的位置:首页 > 编程语言 > Python开发

MySQL-python模块导入笔记06

2017-08-22 11:28 561 查看
这2天搞,用py读写mysql方面东西,安装mysql-python遇到以下问题,Mark下:

环境:Centos 6.9:
Python : 2.6和2.7.10,默认设置2.7.10为默认版本(Centos6系列python版本是2.6.6)
#pip install mysql-python
Collecting mysql-python
Using cached MySQL-python-1.2.5.zip
Installing collected packages: mysql-python
Running setup.py install for mysql-python ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-pmsQOe/mysql-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-EYyQuZ-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb
creating build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/local/python2.7/include/python2.7 -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:44:23: error: my_config.h: No such file or directory
_mysql.c:46:19: error: mysql.h: No such file or directory
_mysql.c:47:26: error: mysqld_error.h: No such file or directory
_mysql.c:48:20: error: errmsg.h: No such file or directory
_mysql.c:88: error: expected specifier-qualifier-list before ‘MYSQL’
_mysql.c:102: error: expected specifier-qualifier-list before ‘MYSQL_RES’
_mysql.c: In function ‘_mysql_Exception’:
_mysql.c:146: warning: implicit declaration of function ‘mysql_errno’
_mysql.c:146: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:149: error: ‘CR_MAX_ERROR’ undeclared (first use in this function)
_mysql.c:149: error: (Each undeclared identifier is reported only once
_mysql.c:149: error: for each function it appears in.)
_mysql.c:161: error: ‘CR_COMMANDS_OUT_OF_SYNC’ undeclared (first use in this function)
_mysql.c:162: error: ‘ER_DB_CREATE_EXISTS’ undeclared (first use in this function)
_mysql.c:163: error: ‘ER_SYNTAX_ERROR’ undeclared (first use in this function)
_mysql.c:164: error: ‘ER_PARSE_ERROR’ undeclared (first use in this function)
_mysql.c:165: error: ‘ER_NO_SUCH_TABLE’ undeclared (first use in this function)
_mysql.c:166: error: ‘ER_WRONG_DB_NAME’ undeclared (first use in this function)
_mysql.c:167: error: ‘ER_WRONG_TABLE_NAME’ undeclared (first use in this function)
_mysql.c:168: error: ‘ER_FIELD_SPECIFIED_TWICE’ undeclared (first use in this function)
_mysql.c:169: error: ‘ER_INVALID_GROUP_FUNC_USE’ undeclared (first use in this function)
_mysql.c:170: error: ‘ER_UNSUPPORTED_EXTENSION’ undeclared (first use in this function)
_mysql.c:171: error: ‘ER_TABLE_MUST_HAVE_COLUMNS’ undeclared (first use in this function)
_mysql.c:200: error: ‘ER_DUP_ENTRY’ undeclared (first use in this function)
_mysql.c:246: warning: implicit declaration of function ‘mysql_error’
_mysql.c:246: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_server_init’:
_mysql.c:351: warning: label ‘finish’ defined but not used
_mysql.c:268: warning: unused variable ‘item’
_mysql.c:267: warning: unused variable ‘groupc’
_mysql.c:267: warning: unused variable ‘i’
_mysql.c:267: warning: unused variable ‘cmd_argc’
_mysql.c:266: warning: unused variable ‘s’
_mysql.c: In function ‘_mysql_ResultObject_Initialize’:
_mysql.c:406: error: ‘MYSQL_RES’ undeclared (first use in this function)
_mysql.c:406: error: ‘result’ undeclared (first use in this function)
_mysql.c:411: error: ‘MYSQL_FIELD’ undeclared (first use in this function)
_mysql.c:411: error: ‘fields’ undeclared (first use in this function)
_mysql.c:425: error: ‘_mysql_ResultObject’ has no member named ‘use’
_mysql.c:428: warning: implicit declaration of function ‘mysql_use_result’
_mysql.c:428: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:430: warning: implicit declaration of function ‘mysql_store_result’
_mysql.c:430: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:431: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:434: warning: implicit declaration of function ‘mysql_field_count’
_mysql.c:434: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:438: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:442: warning: implicit declaration of function ‘mysql_num_fields’
_mysql.c:443: error: ‘_mysql_ResultObject’ has no member named ‘nfields’
_mysql.c:444: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:448: warning: implicit declaration of function ‘mysql_fetch_fields’
_mysql.c:489: error: ‘BINARY_FLAG’ undeclared (first use in this function)
_mysql.c:512: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c: In function ‘_mysql_ResultObject_traverse’:
_mysql.c:526: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:527: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c: In function ‘_mysql_ResultObject_clear’:
_mysql.c:538: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:538: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:538: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:538: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:539: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c: In function ‘_mysql_ConnectionObject_Initialize’:
_mysql.c:551: error: ‘MYSQL’ undeclared (first use in this function)
_mysql.c:551: error: ‘conn’ undeclared (first use in this function)
_mysql.c:584: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:585: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:636: warning: implicit declaration of function ‘mysql_init’
_mysql.c:636: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:639: warning: implicit declaration of function ‘mysql_options’
_mysql.c:639: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:639: error: ‘MYSQL_OPT_CONNECT_TIMEOUT’ undeclared (first use in this function)
_mysql.c:655: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:655: error: ‘MYSQL_OPT_COMPRESS’ undeclared (first use in this function)
_mysql.c:656: error: ‘CLIENT_COMPRESS’ undeclared (first use in this function)
_mysql.c:659: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:659: error: ‘MYSQL_OPT_NAMED_PIPE’ undeclared (first use in this function)
_mysql.c:661: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:661: error: ‘MYSQL_INIT_COMMAND’ undeclared (first use in this function)
_mysql.c:663: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:663: error: ‘MYSQL_READ_DEFAULT_FILE’ undeclared (first use in this function)
_mysql.c:665: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:665: error: ‘MYSQL_READ_DEFAULT_GROUP’ undeclared (first use in this function)
_mysql.c:668: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:668: error: ‘MYSQL_OPT_LOCAL_INFILE’ undeclared (first use in this function)
_mysql.c:676: warning: implicit declaration of function ‘mysql_real_connect’
_mysql.c:676: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:694: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:702: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c: In function ‘_mysql_ConnectionObject_traverse’:
_mysql.c:783: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:784: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c: In function ‘_mysql_ConnectionObject_clear’:
_mysql.c:792: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:792: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:792: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:792: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:793: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c: In function ‘_mysql_ConnectionObject_close’:
_mysql.c:808: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:810: warning: implicit declaration of function ‘mysql_close’
_mysql.c:810: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:812: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c: In function ‘_mysql_ConnectionObject_affected_rows’:
_mysql.c:834: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:835: warning: implicit declaration of function ‘mysql_affected_rows’
_mysql.c:835: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_debug’:
_mysql.c:851: warning: implicit declaration of function ‘mysql_debug’
_mysql.c: In function ‘_mysql_ConnectionObject_dump_debug_info’:
_mysql.c:869: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:871: warning: implicit declaration of function ‘mysql_dump_debug_info’
_mysql.c:871: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_autocommit’:
_mysql.c:895: warning: implicit declaration of function ‘mysql_query’
_mysql.c:895: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_get_autocommit’:
_mysql.c:912: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:912: error: ‘SERVER_STATUS_AUTOCOMMIT’ undeclared (first use in this function)
_mysql.c: In function ‘_mysql_ConnectionObject_commit’:
_mysql.c:932: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_rollback’:
_mysql.c:954: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_errno’:
_mysql.c:1070: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1071: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_error’:
_mysql.c:1086: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1090: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_escape_string’:
_mysql.c:1123: warning: implicit declaration of function ‘mysql_escape_string’
_mysql.c: In function ‘_mysql_escape’:
_mysql.c:1252: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c: In function ‘_mysql_ResultObject_describe’:
_mysql.c:1332: error: ‘MYSQL_FIELD’ undeclared (first use in this function)
_mysql.c:1332: error: ‘fields’ undeclared (first use in this function)
_mysql.c:1335: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1336: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1337: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1348: warning: implicit declaration of function ‘IS_NOT_NULL’
_mysql.c: In function ‘_mysql_ResultObject_field_flags’:
_mysql.c:1368: error: ‘MYSQL_FIELD’ undeclared (first use in this function)
_mysql.c:1368: error: ‘fields’ undeclared (first use in this function)
_mysql.c:1371: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1372: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1373: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c: At top level:
_mysql.c:1419: error: expected declaration specifiers or ‘...’ before ‘MYSQL_ROW’
_mysql.c: In function ‘_mysql_row_to_tuple’:
_mysql.c:1425: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1427: warning: implicit declaration of function ‘mysql_fetch_lengths’
_mysql.c:1427: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1430: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:1431: error: ‘row’ undeclared (first use in this function)
_mysql.c: At top level:
_mysql.c:1444: error: expected declaration specifiers or ‘...’ before ‘MYSQL_ROW’
_mysql.c: In function ‘_mysql_row_to_dict’:
_mysql.c:1449: error: ‘MYSQL_FIELD’ undeclared (first use in this function)
_mysql.c:1449: error: ‘fields’ undeclared (first use in this function)
_mysql.c:1451: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1453: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1454: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1457: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:1458: error: ‘row’ undeclared (first use in this function)
_mysql.c: At top level:
_mysql.c:1483: error: expected declaration specifiers or ‘...’ before ‘MYSQL_ROW’
_mysql.c: In function ‘_mysql_row_to_dict_old’:
_mysql.c:1488: error: ‘MYSQL_FIELD’ undeclared (first use in this function)
_mysql.c:1488: error: ‘fields’ undeclared (first use in this function)
_mysql.c:1490: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1492: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1493: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1496: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:1497: error: ‘row’ undeclared (first use in this function)
_mysql.c: At top level:
_mysql.c:1519: error: expected declaration specifiers or ‘...’ before ‘MYSQL_ROW’
_mysql.c: In function ‘_mysql__fetch_row’:
_mysql.c:1530: error: ‘MYSQL_ROW’ undeclared (first use in this function)
_mysql.c:1530: error: expected ‘;’ before ‘row’
_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:1538: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:1541: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:1549: error: too many arguments to function ‘convert_row’
_mysql.c: In function ‘_mysql_ResultObject_fetch_row’:
_mysql.c:1573: error: expected declaration specifiers or ‘...’ before ‘MYSQL_ROW’
_mysql.c:1588: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1600: error: ‘_mysql_ResultObject’ has no member named ‘use’
_mysql.c:1614: warning: implicit declaration of function ‘mysql_num_rows’
_mysql.c:1614: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c: In function ‘_mysql_ConnectionObject_character_set_name’:
_mysql.c:1681: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c: In function ‘_mysql_get_client_info’:
_mysql.c:1792: warning: implicit declaration of function ‘mysql_get_client_info’
_mysql.c:1792: warning: passing argument 1 of ‘PyString_FromString’ makes pointer from integer without a cast
/usr/local/python2.7/include/python2.7/stringobject.h:63: note: expected ‘const char *’ but argument is of type ‘int’
_mysql.c: In function ‘_mysql_ConnectionObject_get_host_info’:
_mysql.c:1807: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1811: warning: implicit declaration of function ‘mysql_get_host_info’
_mysql.c:1811: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_get_proto_info’:
_mysql.c:1826: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1827: warning: implicit declaration of function ‘mysql_get_proto_info’
_mysql.c:1827: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_get_server_info’:
_mysql.c:1841: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1845: warning: implicit declaration of function ‘mysql_get_server_info’
_mysql.c:1845: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_info’:
_mysql.c:1862: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1863: warning: implicit declaration of function ‘mysql_info’
_mysql.c:1863: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_insert_id’:
_mysql.c:1899: error: ‘my_ulonglong’ undeclared (first use in this function)
_mysql.c:1899: error: expected ‘;’ before ‘r’
_mysql.c:1901: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1903: error: ‘r’ undeclared (first use in this function)
_mysql.c:1903: warning: implicit declaration of function ‘mysql_insert_id’
_mysql.c:1903: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_kill’:
_mysql.c:1920: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1922: warning: implicit declaration of function ‘mysql_kill’
_mysql.c:1922: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_field_count’:
_mysql.c:1941: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1943: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ResultObject_num_fields’:
_mysql.c:1958: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1959: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c: In function ‘_mysql_ResultObject_num_rows’:
_mysql.c:1974: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:1975: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c: In function ‘_mysql_ConnectionObject_ping’:
_mysql.c:2004: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:2005: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:2007: warning: implicit declaration of function ‘mysql_ping’
_mysql.c:2007: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_query’:
_mysql.c:2028: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:2030: warning: implicit declaration of function ‘mysql_real_query’
_mysql.c:2030: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_select_db’:
_mysql.c:2058: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:2060: warning: implicit declaration of function ‘mysql_select_db’
_mysql.c:2060: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_shutdown’:
_mysql.c:2079: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:2081: warning: implicit declaration of function ‘mysql_shutdown’
_mysql.c:2081: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_stat’:
_mysql.c:2106: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:2108: warning: implicit declaration of function ‘mysql_stat’
_mysql.c:2108: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_store_result’:
_mysql.c:2134: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:2135: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:2144: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c: In function ‘_mysql_ConnectionObject_thread_id’:
_mysql.c:2173: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:2175: warning: implicit declaration of function ‘mysql_thread_id’
_mysql.c:2175: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ConnectionObject_use_result’:
_mysql.c:2195: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:2196: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:2205: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c: In function ‘_mysql_ConnectionObject_dealloc’:
_mysql.c:2223: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c: In function ‘_mysql_ConnectionObject_repr’:
_mysql.c:2235: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:2237: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_ResultObject_data_seek’:
_mysql.c:2258: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:2259: warning: implicit declaration of function ‘mysql_data_seek’
_mysql.c:2259: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c: In function ‘_mysql_ResultObject_row_seek’:
_mysql.c:2272: error: ‘MYSQL_ROW_OFFSET’ undeclared (first use in this function)
_mysql.c:2272: error: expected ‘;’ before ‘r’
_mysql.c:2274: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:2275: error: ‘_mysql_ResultObject’ has no member named ‘use’
_mysql.c:2280: error: ‘r’ undeclared (first use in this function)
_mysql.c:2280: warning: implicit declaration of function ‘mysql_row_tell’
_mysql.c:2280: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:2281: warning: implicit declaration of function ‘mysql_row_seek’
_mysql.c:2281: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c: In function ‘_mysql_ResultObject_row_tell’:
_mysql.c:2293: error: ‘MYSQL_ROW_OFFSET’ undeclared (first use in this function)
_mysql.c:2293: error: expected ‘;’ before ‘r’
_mysql.c:2295: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:2296: error: ‘_mysql_ResultObject’ has no member named ‘use’
_mysql.c:2301: error: ‘r’ undeclared (first use in this function)
_mysql.c:2301: error: ‘_mysql_ResultObject’ has no member named ‘result’
_mysql.c:2302: error: ‘_mysql_ResultObject’ has no member named ‘result’
_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:2551: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:2558: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:2565: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:2572: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:2579: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:2642: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:2642: error: initializer element is not constant
_mysql.c:2642: error: (near initialization for ‘_mysql_ResultObject_memberlist[0].offset’)
_mysql.c: In function ‘_mysql_ConnectionObject_getattr’:
_mysql.c:2666: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-pmsQOe/mysql-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-EYyQuZ-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-pmsQOe/mysql-python/

解决方法:
找伟大谷神寻求帮助,一番搜索下来,问题解决

yum install MySQL-python -y
注:centos6.x装的mysql-python是该平台对应版本,也就是2.7.10是用不了的,因为2.7.10默认是7系列版本

检查MySQLdb模块是否正常导入:

#python2.6
Python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
>>>
Centos 6.9 python2.7.10导入提示是找不到该模块:

#python
Python 2.7.10 (default, Jun 27 2017, 17:27:20)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named MySQLdb
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  笔记 Python 06