I'm trying to install MySQLdb for python on Cygwin. Unfortunately, when I run python setup.py build
, I get the following error:
$ python setup.py build
/bin/sh: /usr/local/bin/mysql_config: No such file or directory
Traceback (most recent call last):
File "setup.py", line 16, in <module>
metadata, options = get_config()
File "/home/Ben/python/MySQL-python-1.2.2/setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "/home/Ben/python/MySQL-python-1.2.2/setup_posix.py", line 24, in mysql_config
raise EnvironmentError, "%s not found" % mysql_config.path
EnvironmentError: /usr/local/bin/mysql_config not found
Clearly I don't have mysql_config
installed, which I guess is the problem. This is mentioned in the README for MySQLdb, but it doesn't explain how to either get around it or how to install mysql_config.
So maybe this is as easy as: How can I install mysql_config
for Cygwin?
Or maybe it's harder than that.
FYI: I have python 2.5.2 and MySQL 5.1.30, running under Cygwin.
First, install apt-cyg:
lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg`
install apt-cyg /bin
Now, use apt-cyg to install mysql-devel:
apt-cyg install libmysqlclient-devel
How I did it:
First I installed apt-cyg
. With that:
# apt-cyg install gcc # older name
apt-cyg install gcc-core # as of 2015
apt-cyg install python-setuptools
easy_install pip
pip install -U mysql-python
You'll need mysql-devel, if it's available for cygwin, or you'll need to build mysql from source.
Your best bet is probably to just compile the MySQL client yourself in order to get the necessary headers to compile MySQLdb. See this note on the similar Perl DB driver.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With