[Pythonmac-SIG] MySQLdb lib help

Russell E. Owen rowen at cesmail.net
Wed Jan 18 20:25:35 CET 2006

In article 
 Chris Porter <chrisporter at wi.rr.com> wrote:

> Hello, complete python newbie here.
> I've got:
> OSX 10.4.3
> Python 2.3.5
> MySQL 4.1.15-standard
> (of course, all pre-installed, except for MySQL)
> I don't seem to have the right python module that will allow python to 
> interact with my MySQL
> databases. 
> I am completely not a programmer, but I can follow a cookbook-type 
> instruction set in Terminal, and
> have already set up several MySQL databases and php on my personal intranet. 
> Now I want to run a
> python program (by someone else, of course) that also interacts with my MySQL 
> databases. I've run
> the test query that searches for the MySQLdb python module, and found I don't 
> have it, so I need to
> install it.  So, I found this list. Looked for the past year for information 
> about this issue:
> Bob said in June:
> "You can download a MySQL-python 1.2 installer from:
> http://pythonmac.org/packages/"
> So I did. And installed it (though it's for 10.3) and ran the
> test I found on the web in Terminal:

The 10.3 version of that package should work fine on your system (that's 
why it says "10.3+"). Do make sure you got the version for python 2.3, 
not 2.4, since you're using the preinstalled python.

I'm not sure why it might have failed. Some things to try:
- make sure you only have one python because if you have more MySQLdb 
might have installed on the "wrong" python.
- Try installing it from source. It is trivial and it works for me (on 
MacOS X 10.3.9 and its built-in python). It includes instructions, but 
it uses the standard distutils dance:

- download source
- unpack source
- use Terminal to "cd" into the unpacked source
% python setup.py build
% sudo python setup.py install

Good luck.

-- Russell

More information about the Pythonmac-SIG mailing list