解决:centos安装python-mysql出错

前端之家收集整理的这篇文章主要介绍了解决:centos安装python-mysql出错前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

使用命令pip install MysqL-python的时候报错


_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

----------------------------------------

Command "/usr/bin/python -c "import setuptools,tokenize;__file__='/tmp/pip-build-1dNMXc/MysqL-python/setup.py';exec(compile(getattr(tokenize,'open',open)(__file__).read().replace('\r\n','\n'),__file__,'exec'))" install --record /tmp/pip-YhSNnU-record/install-record.txt --single-version-externally-managed --compile" Failed with error code 1 in /tmp/pip-build-1dNMXc/MysqL-python

解决方法


在安装MysqLdb前安装以下依赖库:

yum install python-devel MysqL-devel zlib-devel openssl-devel

依赖库装好之后,执行pip install MysqL-python

原文链接:https://www.f2er.com/centos/380188.html

猜你在找的CentOS相关文章