Home >Database >Mysql Tutorial >How to Fix \'mysql_config not found\' and \'Setup script exited with error\' When Installing MySQL-python on macOS?

How to Fix \'mysql_config not found\' and \'Setup script exited with error\' When Installing MySQL-python on macOS?

Linda Hamilton
Linda HamiltonOriginal
2024-11-23 09:52:15755browse

How to Fix

Installing MySQL Connector for Python on Mac OS X

You have encountered an issue while attempting to install MySQL Python on Mac OS X. Specifically, you received the error "EnvironmentError: mysql_config not found" when trying to run "sudo easy_install MySQL-python".

Addressing the "EnvironmentError"

To resolve the "EnvironmentError", you should export the path to the MySQL binary directory. However, it appears that you have already done this using the command "export PATH=$PATH:/usr/local/mysql/bin".

Addressing the "Setup script exited with error"

You then encountered a "Setup script exited with error: command 'llvm-gcc-4.2' failed with exit status 1" error. To address this issue, you should install the LLVM-GCC package.

However, it seems that you have already attempted to install this package without success. Instead, we recommend following the alternative steps outlined below:

  1. Install Xcode and the command line tools.
  2. Install Homebrew, a package manager for Mac OS X.
  3. Run the command "brew install mysql-connector-c" to install MySQL Connector for C.
  4. Run the command "pip install mysql-python" to install MySQL Python.

By following these steps, you should be able to successfully install MySQL Python on your Mac OS X system.

The above is the detailed content of How to Fix 'mysql_config not found' and 'Setup script exited with error' When Installing MySQL-python on macOS?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn