Linux学习27-安装mysqlclient提示mysql_config not found问题

∥☆過路亽.° 提交于 2021-01-24 01:52:00

前言

Linux上使用pip 安装mysqlclient 时遇到报错 mysql_config not found 主要原因是缺少依赖包:mysql-devel

遇到问题

使用pip 安装 mysqlclient

pip3 install mysqlclient

出现报错

    /bin/sh: 1: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-ixqbqcm3/mysqlclient/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/tmp/pip-install-ixqbqcm3/mysqlclient/setup_posix.py", line 44, in get_config
        libs = mysql_config("libs_r")
      File "/tmp/pip-install-ixqbqcm3/mysqlclient/setup_posix.py", line 26, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    OSError: mysql_config not found
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-ixqbqcm3/mysqlclient/
You are using pip version 18.1, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

报错提示:mysql_config not found

安装mysql-devel

centos系统使用yum安装 mysql-devel

yum install mysql-devel

ubuntu 系统apt-get 安装libmysqlclient-dev

apt-get update apt-get upgrade apt-get install libmysqlclient-dev

debian 系统

apt install -y libmariadbd18 apt install -y libmariadbd-dev

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!