Python 2.7 via MacPorts
I have recently upgraded to use Python 2.7 on my Mac for local development work for a python/django project and needed to use py27-mysql. So naturally, this is what I did…
calvin$ sudo port -v install python27 calvin$ sudo python_select python27 calvin$ sudo port -v install py27-setuptools
Unfortunately when I attempted to install py27-mysql via MacPorts, this is the error I received:
calvin$ sudo port -v install py27-mysql ---> Computing dependencies for py27-distribute.Error: Unable to execute port: Can't install py27-distribute because conflicting ports are installed: py27-setuptools To report a bug, see <http://guide.macports.org/#project.tickets>
It appears that py27-mysql needs to use py27-distribute instead of py27-setuptools.
To solve this problem, I decided to uninstall py27-setuptools and give py27-distribute a spin. So:
calvin$ sudo port -v uninstall py27-setuptools ---> Deactivating py27-setuptools @0.6c11_1 ---> Uninstalling py27-setuptools @0.6c11_1 ---> Uninstall is removing py27-setuptools from the port registry. calvin$ sudo port -v install py27-mysql ---> Computing dependencies for py27-mysql.. ---> Dependencies to be installed: py27-distribute ---> Fetching py27-distribute ---> Verifying checksum(s) for py27-distribute ---> Checksumming distribute-0.6.15.zip ---> Extracting py27-distribute ---> Extracting distribute-0.6.15.zip ---> Configuring py27-distribute ---> Building py27-distribute ... running install_egg_info running egg_info writing MySQL_python.egg-info/PKG-INFO writing top-level names to MySQL_python.egg-info/top_level.txt writing dependency_links to MySQL_python.egg-info/dependency_links.txt deleting MySQL_python.egg-info/native_libs.txt reading manifest file 'MySQL_python.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'MySQL_python.egg-info/SOURCES.txt' Copying MySQL_python.egg-info to /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py27-mysql/work/destroot/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MySQL_python-1.2.2-py2.7.egg-info running install_scripts ---> Installing py27-mysql @1.2.2_0+mysql5 ---> Activating py27-mysql @1.2.2_0+mysql5 ---> Cleaning py27-mysql ---> Removing work directory for py27-mysql
And magically, py27-mysql now works as required.
Hurrah. :-)

Linux users would be familiar with “