Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has anyone installed MySQLdb for Python on Cygwin?

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.

like image 945
Ben Avatar asked Feb 06 '09 16:02

Ben


3 Answers

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
like image 73
Christopher Su Avatar answered Sep 28 '22 17:09

Christopher Su


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
like image 43
static_rtti Avatar answered Sep 28 '22 18:09

static_rtti


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.

like image 30
Yoni Samlan Avatar answered Sep 28 '22 16:09

Yoni Samlan