views:

1311

answers:

4

I'm trying to install the mysql bindings in a virtualenv. I'd prefer to use pip or easy_install. pip gives me the following error:

  File "setup_posix.py", line 24, in mysql_config

    raise EnvironmentError("%s not found" % (mysql_config.path,))

EnvironmentError: mysql_config not found

easy_install either gets a 404 from sourceforge or gives me a very similar error.

Does anyone know how to get around this in a virtualenv?

A: 

It is failing to find mysql_config. Put the directory containing mysql_config on your path and try again.

stray
A: 

You may not have mysql_config at all if you don't have the appropriate mysqlclient-dev OS package installed.

Personally, for packages that require extensive C compilation, I prefer to install OS-packaged versions, as I've had fewer problems that way. It's easier to install the OS-packaged version of mysql-python on all my servers than it is to install the compilation dependencies.

Fortunately in my experience those packages also tend to be very stable (mysql-python, PIL, lxml, etc), so I don't need to version-pin them per-project.

It does, however, prevent me from using virtualenv --no-site-packages, which is a little annoying.

Carl Meyer
+6  A: 

I'm also trying to setup MySQL bindings in a virtualenv. All I had to do was install the package that contains mysql_config. On Ubuntu it's called libmysqlclient-dev.

After that I was able to do a (virtualenv'd) python setup.py build and python setup.py install.

ariddell
A: 

no no no

read this, everybody will be happy.

http://www.brainfault.com/2008/04/18/install-python-mysql-mysqldb-on-mac-osx/