具体报错信息:

root@pts/4 $ pip install MySQL-python
Collecting MySQL-python
Using cached MySQL-python-1.2.5.zip
Complete output from command python setup.py egg_info:
sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-kWowP9/MySQL-python/setup.py", line 17, in <module>
metadata, options = get_config()
File "setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "setup_posix.py", line 25, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-kWowP9/MySQL-python/

mysql_config是来自于 mysql-devel ,我用的是MySQL社区版,所以实际安装的是mysql-community-devel,网上的说法是同时安装python-devel,如果你没有安装的话一起安装

yum install python-devel mysql-community-devel -y

安装完成之后尝试再次 pip 安装 MySQL-python


再次安装

root@pts/4 $ 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 ... done
Successfully installed MySQL-python-1.2.5

验证

root@pts/1 $ python
Python 2.7.5 (default, Sep 15 2016, 22:37:39)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
>>> MySQLdb.
MySQLdb.BINARY MySQLdb.OperationalError( MySQLdb.__hash__( MySQLdb.debug(
MySQLdb.Binary( MySQLdb.ProgrammingError( MySQLdb.__init__( MySQLdb.escape(
MySQLdb.Connect( MySQLdb.ROWID MySQLdb.__name__ MySQLdb.escape_dict(
MySQLdb.Connection( MySQLdb.STRING MySQLdb.__new__( MySQLdb.escape_sequence(
MySQLdb.DATE MySQLdb.TIME MySQLdb.__package__ MySQLdb.escape_string(
MySQLdb.DATETIME MySQLdb.TIMESTAMP MySQLdb.__path__ MySQLdb.get_client_info(
MySQLdb.DBAPISet( MySQLdb.Time( MySQLdb.__reduce__( MySQLdb.paramstyle
MySQLdb.DataError( MySQLdb.TimeFromTicks( MySQLdb.__reduce_ex__( MySQLdb.release
MySQLdb.DatabaseError( MySQLdb.Timestamp( MySQLdb.__repr__( MySQLdb.result(
MySQLdb.Date( MySQLdb.TimestampFromTicks( MySQLdb.__revision__ MySQLdb.server_end(
MySQLdb.DateFromTicks( MySQLdb.Warning( MySQLdb.__setattr__( MySQLdb.server_init(
MySQLdb.Error( MySQLdb.__all__ MySQLdb.__sizeof__( MySQLdb.string_literal(
MySQLdb.FIELD_TYPE MySQLdb.__author__ MySQLdb.__str__( MySQLdb.test_DBAPISet_set_equality(
MySQLdb.IntegrityError( MySQLdb.__class__( MySQLdb.__subclasshook__( MySQLdb.test_DBAPISet_set_equality_membership(
MySQLdb.InterfaceError( MySQLdb.__delattr__( MySQLdb.__version__ MySQLdb.test_DBAPISet_set_inequality(
MySQLdb.InternalError( MySQLdb.__dict__ MySQLdb._mysql MySQLdb.test_DBAPISet_set_inequality_membership(
MySQLdb.MySQLError( MySQLdb.__doc__ MySQLdb.apilevel MySQLdb.thread_safe(
MySQLdb.NULL MySQLdb.__file__ MySQLdb.connect( MySQLdb.threadsafety
MySQLdb.NUMBER MySQLdb.__format__( MySQLdb.connection( MySQLdb.times
MySQLdb.NotSupportedError( MySQLdb.__getattribute__( MySQLdb.constants MySQLdb.version_info
>>>
>>> MySQLdb.version_info
(1, 2, 5, 'final', 1)
>>>

作者:全栈运维
链接:https://www.jianshu.com/p/827cf26568d8
來源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

python[error] - mysql_config not found的更多相关文章

  1. Python--Cmd窗口运行Python时提示Fatal Python error: Py_Initialize: can't initialize sys standard streams LookupError: unknown encoding: cp65001

    源地址连接: http://www.tuicool.com/articles/ryuaUze 最近,我在把一个 Python 2 的视频下载工具 youku-lixian 改写成 Python 3,并 ...

  2. [转]Resolving Python error: Unable to find vcvarsall.bat

    Resolving Python error: Unable to find vcvarsall.bat While installing python package flask-user usin ...

  3. Python 'takes exactly 1 argument (2 given)' Python error

    Python,定义urlConfig 接收参数,正常传递参数时,出现,多给了一个参数的错误问题, 定义class的函数之后,在调用的时候出现“'takes exactly 1 argument (2 ...

  4. U盘装manjaro 18报Python error in job “initcpio”

    更新: 还是不行,大家再找别的方法. 以下内容仅做参考,意义不大. U盘安装 用rufus做U盘,写入选DD模式,比ISO模式可靠点. 错误解决 报错信息: Error installing Manj ...

  5. Python error: Unable to find vcvarsall.bat

    在安装一些Python模块时,大部分是cpython写的模块时会发生如下错误 error: Unable to find vcvarsall.bat.先前的一篇文章:在Windows上安装Scrapy ...

  6. Huge CSV and XML Files in Python, Error: field larger than field limit (131072)

    Huge CSV and XML Files in Python January 22, 2009. Filed under python twitter facebook pinterest lin ...

  7. Python error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat)解决方案

    error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat). Get it - 解决方案 python通过pi ...

  8. Python error: Microsoft Visual C++ 9.0 is required 解决方案

    换了新电脑,在使用python2.7 pip 安装ipython时,报错了 error: Microsoft Visual C++ 9.0 is required. Get it from http: ...

  9. Linux 移除python Error: Trying to remove “yum”, which is protected

    >yum intall python >yum -y remove python 出现Error: Trying to remove "yum", which is p ...

随机推荐

  1. 简单易用的IT运维服务器管理程序

    程序修改历史: 2012.02.04 v1.0 leopku 2012.02.09 v1.1 oldboy(老男孩) QQ:31333741 MAIL:oldboy521@gmail.com 本软件由 ...

  2. dedecms织梦网站图片集上传图片出现302错误图片提示怎么解决 已测

    时间:2016-01-20 来源:未知 作者:模板之家 阅读:次 小编今天上传织梦网站模板的时候,在图片集里面选择上传图片的时候,弹出302错误提示,当是真的是郁闷了,试了好几次,开始还以为是图片过大 ...

  3. 一步步部署基于Windows系统的Jenkins持续集成环境

    如题:本文将介绍如何在Windows环境下运用Jenkins部署持续集成环境.之所以写本文,是因为在最近工作当中,学习使用Jenkins时,确实遇到了一些问题,而大多数教程文档都是基于Mac或是Lin ...

  4. Django类方式写view

    问题: Django官方教程中都是通过def函数方式来写view,如何通过类方式写view以及为何要通过类方式写view? 那,如何解决这个问题? 用户访问浏览器,一般两种方式,get获取网页和pos ...

  5. JavaScript之点赞特效

    在很多网站中登录后可以对你说喜欢的文章.图片之类的进行点赞,这个功能效果的实现就是我今天要写的东西.代码不长,但觉得还是很有用的,为 js 给用户交互体验上更加友好.在实现过程中,主要的思路有: 点赞 ...

  6. 【Java SE】如何安装JDK以及配置Java运行环境

    摘要:不管是作为苦逼的Java码农,还是高端大气的Java系统架构师,如果不会安装JDK以及配置Java运行环境,那就巧妇难为无米之炊,不能进行Java后续的代码编写.当然如果你是Myeclipse编 ...

  7. java类路径classpath和包

    */ .hljs { display: block; overflow-x: auto; padding: 0.5em; color: #333; background: #f8f8f8; } .hl ...

  8. $.ajax()实现简单计算器

    1.html页面  a.html <!DOCTYPE html> <html lang="en"> <head> <meta charse ...

  9. bzoj4326 运输计划

    4326: NOIP2015 运输计划 Time Limit: 30 Sec  Memory Limit: 128 MB Description 公元 2044 年,人类进入了宇宙纪元.L 国有 n ...

  10. linux tar 压缩解压命令

    tar命令: -c 压缩-x 解压缩-t 不解压的情况下查看文件内容-r 向压缩文件追加文件-u 更新压缩文件 以上参数必须和'-f'参数连用,且'-f'必须为最后一个参数,后接文档名 -z 对应gz ...