Your browser (Internet Explorer 7 or lower) is out of date. It has known security flaws and may not display all features of this and other websites. Learn how to update your browser.


Python MySQL Library Installation Issues

Installing mysql-python in Mac OS X 10.6.7 Snow Leopard

Installing mysql-python in my Mac OS X 10.6.7 Snow Leopard was a painful experience. After some hours of trial and error and googling I got it working. Here are the steps:
1. Make sure you have gcc installed. I installed Xcode 3.2.6 which is the Apple’s development environment and it includes gcc. I lost my DVD somewhere. So I had to download it from their website. It’s around 4.4 GB. In the process of installing it, it might ask you to close your iTunes and might keep asking you even if iTunes is closed. You will have to close iTunesHelper to continue the installation. Open Activity Monitor (located in Applications/Utilities) and quit it from the list of processes.
2. Download the mysql-python tar.gz file from here. Untar it and then build and install it. To do this (assuming that you have uncompressed the tar.gz file and pointed your terminal to the uncompressed directory):

$ sudo su
# python build
# python install

3. Finally, add your mysql lib directory in DYLD_LIBRARY_PATH. You can add the following line in your .bash_profile file modifying your mysql directory location.
export DYLD_LIBRARY_PATH='/usr/local/mysql-5.5.25-osx10.6-x86_64/lib/'

4. Now, in your python interactive console try to import MySQLdb. If there is no error you are done! Otherwise please google These steps worked for me.