I am trying to install MySQLdb for Python 2.6 as per these instructions:
http://www.tutorialspoint.com/python/python_database_access.htm
When I get to this step: $ python setup.py build I get the error:
users-MacBook-Pro:MySQL-python-1.2.3 user$ sudo python setup.py build
sh: mysql_config: command not found
Traceback (most recent call last):
File "setup.py", line 15, in
metadata, options = get_config()
File "/my_crawler/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "/my_crawler/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
I have MySQL installed and added to my bash
What am I doing wrong?
It’s not looking for ‘mysql’, it’s looking for ‘mysql_config’. Try running ‘which mysql_config’ from bash. It probably won’t be found. That’s why the build isn’t finding it either. Try running ‘locate mysql_config’ and see if anything comes back. The path to this binary needs to be either in your shell’s $PATH environment variable, or it needs to be explicitly in the setup.py file for the module assuming it’s looking in some specific place for that file.
If you installed mysql from source in /usr/local, I believe the file will be found at /usr/local/mysql/bin/mysql_config