zoukankan      html  css  js  c++  java
  • Centos 6.5安装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-Lil8nB/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-Lil8nB/MySQL-python/

    解决方法:(注:这里只是我遇到的问题,摸索到的解决方法,并不表示可以解决所有遇到此类的错误!)

    [root@sishen ~]#python -m pip install --upgrade --force pip

    [root@sishen ~]#pip install setuptools==33.1.1

    [root@sishen ~]#yum install -y mysql-dev python-dev libmysqlclient-dev    (红色部分,依据个人情况安装)

    [root@sishen ~]#pip install MySQL-python

    测试

    [root@sishen ~]# python
    Python 2.7.14 (default, Sep 20 2017, 20:34:26)
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import MySQLdb
    >>>

    这就表示已经成功安装MySQL-python。

  • 相关阅读:
    谷歌Cartographer ROS初探
    在Ubuntu14.04_ROS_indigo上安装Kinect2驱动和bridge
    Turtlebot入门篇
    关于CV、SLAM、机器人导航的碎碎念
    C#与C++的区别!
    ++i 与 i++
    "+" 是怎样连接字符串的?
    不要重复你自己
    实习第四天
    微信小程序添加外部地图服务数据
  • 原文地址:https://www.cnblogs.com/zd520pyx1314/p/7790059.html
Copyright © 2011-2022 走看看