Install MYSQL-PYTHON package error mysql_config not found solution

Source: Internet
Author: User

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:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.