如何解决centos7安装MySQLdb-python报错
如何解决centos7安装MySQLdb-python报错,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。
运行pip installMySQL-Python报错:云服务器
Commandpythonsetup.pyegg_infofailedwitherrorcode1in
继续试探
yuminstallmysql-develsystemctlrestartmariadb
之后再安装报错:
Command"/usr/bin/python-u-c"importsetuptools,tokenize;__file__='/tmp/pip-build-GMXMYA/MySQL-python/setup.py';f=getattr(tokenize,'open',open)(__file__);code=f.read().replace('','');f.close();exec(compile(code,__file__,'exec'))"install--record/tmp/pip-VMNV_c-record/install-record.txt--single-version-externally-managed--compile"failedwitherrorcode1in/tmp/pip-build-GMXMYA/MySQL-python/
继续找安装
yuminstallMySQL-pythonsystemctlrestartmariadb
测试是否安装成功
python
进入 python之后 执行
>>>importMySQLdb>>>printdir(MySQLdb)['BINARY','Binary','Connect','Connection','DATE','DATETIME','DBAPISet','DataError','DatabaseError','Date','DateFromTicks','Error','FIELD_TYPE','IntegrityError','InterfaceError','InternalError','MySQLError','NULL','NUMBER','NotSupportedError','OperationalError','ProgrammingError','ROWID','STRING','TIME','TIMESTAMP','Time','TimeFromTicks','Timestamp','TimestampFromTicks','Warning','__all__','__author__','__builtins__','__doc__','__file__','__name__','__package__','__path__','__revision__','__version__','_mysql','apilevel','connect','connection','constants','debug','escape','escape_dict','escape_sequence','escape_string','get_client_info','paramstyle','release','result','server_end','server_init','string_literal','test_DBAPISet_set_equality','test_DBAPISet_set_equality_membership','test_DBAPISet_set_inequality','test_DBAPISet_set_inequality_membership','thread_safe','threadsafety','times','version_info']
因为系统用yum install MySQLdb-python来替代pip install MySQLdb-pythonAuthor:
看完上述内容,你们掌握如何解决centos7安装MySQLdb-python报错的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注亿速云行业资讯频道,感谢各位的阅读!
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。