Error not fund MySQL when installing mysqlclient in MAC environment_ config

Time:2021-8-13

Problem introduction

When using Django to develop web projects, most developers must encounter a problem, that is, the installation of mysqlclient, which often reports errors. The core is

not fund mysql_config

This is because in/usr/local/binMySQL not found under path_ Caused by the conf GI configuration file. The solution is as follows:

Install mysql-connector-c

brew install mysql-connector-c

Homebrew has been installed on the premise. This is a very useful package management tool for Mac. If it is not installed, you can try it.

After installation, the installation path is generally/usr/local/Cellar/mysql-client/8.0.21/binNext, uselsCommand can see that there is amysql_configconfiguration file

Configure soft connection

cd /usr/local/bin
ls -n /usr/local/Cellar/mysql-client/8.0.21/bin/mysql_config /usr/local/bin/mysql_config

Reinstall

pip install mysqlclient

Success ~

This work adoptsCC agreement, reprint must indicate the author and the link to this article