debian/ubuntu 之 mariadb 安裝 python mysqlclient 套件

在 mariadb 套件安裝在系統下
再安裝python mysqlclient 套件

/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File “”, line 1, in
File “/tmp/pip-build-haw2jzkl/mysqlclient/setup.py”, line 17, in
metadata, options = get_config()
File “/tmp/pip-build-haw2jzkl/mysqlclient/setup_posix.py”, line 44, in get_config
libs = mysql_config(“libs_r”)
File “/tmp/pip-build-haw2jzkl/mysqlclient/setup_posix.py”, line 26, in mysql_config
raise EnvironmentError(“%s not found” % (mysql_config.path,))
OSError: mysql_config not found

解決:
apt-get -y install libmariadb-dev libmariadbclient-dev libmariadb-dev-compat
再安裝:
pip3 install mysqlclient
就成功