[Pythonmac-SIG] MySQLdb lib help

David Warde-Farley david.warde.farley at utoronto.ca
Wed Jan 18 09:31:34 CET 2006


On 16-Jan-06, at 11:44 AM, Chris Porter 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.
>

The MySQLdb module doesn't come standard. And seeing as how I can't  
get it to build properly with Apple's Python (and Apple's Python is  
kind of icky anyway), here's the rundown:

Firstly, you'll probably want to install Python 2.4 from http:// 
undefined.org/python/, and the Tiger fix. You'll want to modify your  
shell's PATH variable so that /usr/local/bin comes before /usr/bin.  
If you use bash (other people: is this the default in OS X? I  
honestly can't remember), this should be as simple as adding the line

export PATH=/usr/local/bin:$PATH

to the end of .bash_profile in your user directory.

Finally, grab the zip file for the MySQLdb module from pythonmac.org/ 
packages and install it that way.

Now run python at the command prompt (make sure to start a new  
terminal window after changing .bash_profile ), make sure it's Python  
2.4.1 you're running, and try importing again.

Hope that helps,

- Dave



More information about the Pythonmac-SIG mailing list