Linux学习27-安装mysqlclient提示mysql_config not found问题
前言
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