I have the following set up:
- MySQL 5.6.16
- Python 2.7.3
- PyCharm 3.1.1, which was used to create
- a Python virtual environment with pip located in $HOME/upharm27
$ locate mysql_config ... /usr/local/mysql-5.6.16-osx10.7-x86_64/bin/mysql_config ... $ export PATH=$PATH:/usr/local/mysql-5.6.16-osx10.7-x86_64/bin $ ~/upharm27/bin/pip install mysql-python
I have gcc 4.7.2 available, but curiously, the installer gave the following message:
Installing collected packages: mysql-python Running setup.py install for mysql-python gcc-4.2 not found, using clang instead
The install succeeded using clang, so it’s nothing more than a curiosity at this point.
I was able to verify that the package was installed with:
$ ~/upharm27/bin/python Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import MySQLdb >>>
I just followed these notes using the latest XCode 5.1 on OS X 10.9 and the mysql-python install failed. Apparently the clang Apple ships produces errors on unknown flags by default. I was able do get around this by:
$ export CFLAGS=-Qunused-arguments $ export CPPFLAGS=-Qunused-arguments $ ~/upharm27/bin/pip install mysql-python
Thanks to the good folks at StackOverflow. More details may be found here.