最近学习django项目 有使用到mysqlclient 但是在macos中安装mysqlclient失败报错 卡了好长时间找问题 特此记录一下
报错信息:
/bin/sh: mysql_config: command not found
/bin/sh: mariadb_config: command not found
/bin/sh: mysql_config: command not found
网上找到了好多资料都没有解决 最后发现官方文档有说明
Install MySQL and mysqlclient:
# Assume you are activating Python 3 venv
$ brew install mysql
$ pip install mysqlclient
If you don't want to install MySQL server, you can use mysql-client instead:
# Assume you are activating Python 3 venv
$ brew install mysql-client
$ echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile
$ export PATH="/usr/local/opt/mysql-client/bin:$PATH"
$ pip install mysqlclient
官网地址:GitHub - PyMySQL/mysqlclient: MySQL database connector for Python (with Python 3 support)