Installing MySQL Python on Mac OS X

macos, mysql, python

Solution

Another option is to use pymysql it is a pure Python client connection to MySQL so you don't have to mess around with compiling, a good exercise, but it can be frustrating if you are just trying to get something done. pymysql follows the same API as MySQLdb, it can essentially be used as a drop in replacement.

Also, it used to be that MySQLdb, did not work with Python 3, but this may have changed, pymysql didn't have that problem which also induced me to switch, this may have changed though. pymysql can be slower than MySQLdb but you'll have to see if you notice that, it is also under a different license (MIT for pymysql, GPL for MySQLdb)

Problem

Long story short, when I write the following: ``` sudo easy_install MySQL-python ``` I get the error EnvironmentError: mysql_config not found All right, so there are plenty of threads and the like on how to fix that, so I run this code: ``` export PATH=$PATH:/usr/local/mysql/bin ``` Then I rerun my sudo code: ``` sudo easy_install MySQL-python ``` Then I get the following error. Setup script exited with error: command 'llvm-gcc-4.2' failed with exit status 1 Google/Stack Overflow that, and I am told to download a GCC package which I did the other day, 200 MB's or there-abouts and still no fix. At this point I am lost, they say insanity is doing the same thing over and over while expecting a different result. Well, I've continually run the aforementioned code expecting a different result, so I'm not to far away from going insane. At this point in my Python career, I am new to this, but I am willing to try pretty much anything to get this up and running. If it helps I am officially running, Mac OS X 10.7.5, and I do have MAMP installed (is that an issue?) Also, the other day when I was trying all of this for the first time I installed (reinstalled?) MySQL, so I'm really in a tough spot at this point. Is there a fix? I've racked my brain, searched Google, read Stack Overflow, and spent hours trying to figure this out to no avail.

Original source

Related problems