I was having issues setting up MySQL Python when I was setting up a Django development environment on Mac OS X. This works fine on Ubuntu and Windows Machines, but it appears installing Python’s MySQL (MySQLdb) can be difficult on Mac OS. See this post http://forums.mysql.com/read.php?50,175059,179979
It tried the following compilation but it ran with some errors:
Anyhow a bunch of people have had problems with this. Here is what I did to get it to work nice and easy:
Download this file. mysql_python-122-py25-macosx-105-i386.egg Install this egg file to file: to /Library/Python/2.5/site-packages/. So open up a terminal shell and do something like:
sudo cp mysql_python-122-py25-macosx-105-i386.egg /Library/Python/2.5/site-packages/
Now create and edit a text file here /Library/Python/2.5/site-packages/myeggs.pth:
sudo nano /Library/Python/2.5/site-packages/myeggs.pth
Now put the full path to the egg in the file:
Save the file:
Save changes? Y
That’s it. All should be working. Compiling Python_MySql from scratch should not be necessary. If you are using Django, you can test this with:
python manage.py syncdb
You can also test it just using Python by:
>>> import MySQLdb
If you see no error, then the library is present. If you see “ImportError: No module named MySQLdb”, then something has gone wrong.
Change the above based on your local settings. Happy coding.