Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sofadesign/358638 to your computer and use it in GitHub Desktop.
Save sofadesign/358638 to your computer and use it in GitHub Desktop.
# mysql-python + snow leopard + mysql build with macports #
# Because on Snow Leopard macports installs the 64bits version of Mysql Server,
# you can't simply make a `python easy_install mysql-python`
# So we need to download sources and build it with correct flags. After fetching sources [MySQL-python-1.2.3c1](http://sourceforge.net/projects/mysql-python/):
tar xzf MySQL-python-1.2.3c1.tar.gz
cd MySQL-python-1.2.3c1
# Edit the `setup_posix.py` file: change line 26 from
# mysql_config.path = "mysql_config"
#
# to
#
# mysql_config.path = "/opt/local/lib/mysql5/bin/mysql_config"
#
# Now you can build it
sudo ARCHFLAGS='-arch x86_64' python setup.py build
sudo ARCHFLAGS='-arch x86_64' python setup.py install
# Check now that everything is working:
#
# eac:~ fabrice$ python
# Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29)
# [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
# Type "help", "copyright", "credits" or "license" for more information.
# >>> import MySQLdb
# >>>
#
# ---
#
# Références:
#
# - <http://cd34.com/blog/programming/python/mysql-python-and-snow-leopard/>
# - <http://forums.mysql.com/read.php?50,282410,282835#msg-282835>
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment