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:
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:
