Question

I have MAMP already installed in my mac. So the mysql in MAMP is running just fine. But when i try to install mysqldb , I get the following error

Traceback (most recent call last):
 File "setup.py", line 15, in <module>
metadata, options = get_config()
File "/Users/mohitdeepsingh/Downloads/MySQL-python-1.2.3/setup_posix.py", line 43, in    get_config
   libs = mysql_config("libs_r")
File "/Users/mohitdeepsingh/Downloads/MySQL-python-1.2.3/setup_posix.py", line 24, in     mysql_config
 raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found

How should I troubleshoot this. Most of the recommendations are to install mysql etc but isnt mysql already there. Do I need to change some sort of config file?If so can anyone point which config file I should be modifying

Was it helpful?

Solution

You have to figure out, if there is a mysql_config binary in the MAMP, and if it is there, then to do:

export PATH="path-to-the-dir-with-mysql-config:$PATH"

before installing MySQL-python.

OTHER TIPS

Building MySQLdb on mac requires header files and dynamic libraries for MySQL, which are not included by standard MAMP. If you insist on using MAMP purely you can read this guide.

Fortunately, there's a simpler solution: installing py27-mysql and then using mysql's headers and libs. Here's how it worked for me:

$ sudo port install py27-mysql

$ sudo env "PATH=$PATH:/opt/local/lib/mysql5/bin" pip install mysql-python
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top