If you use pip install MySQL-python to install MySQL, you may encounter the following problems:
1. Error message: EnvironmentError: mysql_config not found
This is because the local host is a Mac OSX system and MySQL is installed in the MAMP integration environment. In fact, the mysql_config file exists, but there is a problem with the path in the default package, you can reinstall a MySQL instance to the default system location, but since MySQL already exists, you do not want to reinstall it.
The solution is to download a MySQL-python package from the pypi official website, modify the setup_posix.py file, and find the place to define the path of mysql_config, as shown in the following code: /Applications/MAMP/Library/bin/mysql_config. The specific path depends on the situation. You can search for mysql_config. If the path is found, this is the location of the Mysql_config file under MAMP.
Go to the package directory and run the python setup. py install command to start installation.
2. The above error is fixed, and the error fatal error: 'My _ config. H' file not found is prompted.
This is because MySQL that comes with MAMP does not contain dev headers. Use brew install mysql-connector-c to install MySQL.
After the installation is complete, go back to Python and reinstall the MySQL-python package.
If you encounter a problem using brew install mysql-connector-c, refer to the link: