views:

137

answers:

3

I've got PyDev installed in Eclipse. I'm trying to play with Django. I'm got a remote MySQL database set up. I would really like to not install MySQL on my MacBook.

Trying to set up the MySQL plugin for python, I get

(djangotest)jeebus:MySQL-python-1.2.3 blah$ python setup.py clean
sh: mysql_config: command not found
Traceback (most recent call last):
  File "setup.py", line 15, in <module>
    metadata, options = get_config()
  File "/Users/nali/djangotest/temp/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config
    libs = mysql_config("libs_r")
  File "/Users/nali/djangotest/temp/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

The error makes sense since I don't have any of MySQL or related tools set up.

Are there an Snow Leopard MySQL libraries I can use to satisfy the need for mysql_config without actually installing MySQL?

A: 

Why not use macports instead. It also has a gui called porticus.

Marconi
I see macports has py26-mysql, but its dependency is MySQL, so that kind of defeats what I'm trying to do. Unless I misunderstood?
Hello
A: 
pip install mysql-python

... or use easy_install if you don't have pip.

Daniel
get the same error with pip: EnvironmentError: mysql_config not found
Hello
I don't know... I think I'd just go ahead and install MySql locally. Also note, for Django dev development sqlite is generally easier to work with.
Daniel
+1  A: 

In a word, no. You need the client side libraries of MySQL but you don't need the server components. Most package managers provide each as separate packages.

MySQL-python, AKA MySQLdb, is not a client module per se. It is a wrapper or interface between Python programs and the standard MySQL client libraries. MySQLdb conforms to the Python standard DB API. There are other conforming adapters implemented for other database managers. Using the common API makes it much easier to write database-independent code in Python; the adapters handle (much of) the messy differences among the various database client libraries. Thus, you do need to install MySQL client libraries; there are several ways to do this: the easiest options are probably downloading prebuilt libraries from mysql.com or you can use a package manager, like MacPorts, to install them and other dependencies.

For OS X 10.6, because of the potential gotchas in getting all of the needed pieces installed in a compatible manner, I highly recommend using a total solution from MacPorts to get Python MySQL support. See the answer here for more details. MacPorts even provides a Django port.

Ned Deily