It seems that it is not easy to make such a good job. Record it here.
- Click to download the python driver of MySQL.
- Decompress the downloaded file.
- In the terminal, go to the decompressed file directory, which contains site. cfg to open the configuration file.
- Mysql_config in is commented out. Remove the comment and change it to the path under mysql. My name is mysql_config =/usr/local/MySQL/bin/mysql_config.
- Switch to the above directory on the terminal and use $ Python setup. py build.
- Then $ Python setup. py install.
- If the error persists, it is okay.
- However, if you want to directly import data on the terminal, an error may be returned:Library not loaded: libmysqlclient.18.dylib.
- In this case, use $ sudo ln-S/usr/local/MySQL/lib/libmysqlclient.18.dylib/usr/lib to link the Library to the/usr/lib directory.
- And then import the data. Basically, it's OK.