欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

centos 7 安装mysqlclient报错mysql_config not found

程序员文章站 2022-05-29 11:06:28
...

具体报错如下:

[[email protected] ~]#  pip install mysqlclient
Collecting mysqlclient
  Downloading http://pypi.doubanio.com/packages/6f/86/bad31f1c1bb0cc99e88ca2adb7cb5c71f7a6540c1bb001480513de76a931/mysqlclient-1.3.12.tar.gz (89kB)
    100% |████████████████████████████████| 92kB 3.8MB/s 
    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-mPr2_0/mysqlclient/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 44, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 26, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found
    

解决方法,先安装mysql-devel,再安装mysqlclient

yum install mysql-devel

pip install mysqlclient