# Assume you are activating Python 3 venv
$ brew install mariadb pkg-config mysql-client
# For pkg-config to find mysql-client you may need to set PKG_CONFIG_PATH.
# This path can be found when you brew install mysql-client, replace below with yours.
$ export PKG_CONFIG_PATH="/usr/local/opt/mysql-client/lib/pkgconfig"
$ pip install mysqlclient
References