Analysis of the process of installing mysqlclient on MAC


Try to install via PIP in a virtual environment:

pip install mysqlclient

And then an error is reported: oserror: MySQL_ config not found

Find official documents , explaining that another module needs to be installed before installation:

brew install mysql-connector-c

But the report is wrong:

Check the error information before installing mysql-connector-c

brew unlink mysql

However, if you continue to install, you will still report an error:

Check the official instructions, the original MAC OS will need to MySQL_ In config

# on macOS, on or about line 112:
# Create options 
libs="$libs -l "

Change to

# Create options 
libs="$libs -lmysqlclient -lssl -lcrypto"

Now it’s easy to do. Let’s go straight

which mysql_config

Find the file path, move to the path, modify the content with VIM, exit and re execute

pip install mysqlclient

And it worked.

In fact, there are other modules connected to MySQL under python, such as pymysql, etc. It’s not so troublesome to install under Mac.

The above is the whole content of this article, I hope to help you learn, and I hope you can support developer more.

Recommended Today

A case of SQL optimization: or condition optimization

This paper is compiled from:Kangaroo cloud technology | SQL optimization case ( two ) : or condition optimization Data stack is a cloud native station data center PAAS. We have an interesting open source project on GitHub: Flinkx is a Flink based batch flow unified data synchronization tool, which can collect both static data, such […]