title: Error importing MySQLdb for Python on Mac OS X
body: <p>I've spent what feels like forever running down MySQL blogs and SO questions trying to figure out how to install a MySQL server and MySQLdb for Python on my Mac OS 10.6.7.  I think I got the MySQL server installed through MacPorts(which took an eternity), but I can't import MySQLdb (<a href="http://sourceforge.net/projects/mysql-python/" rel="nofollow noreferrer">downloaded from here</a>) with Python.</p>
  
  <p>Here's the error I get:</p>
  
  <pre><code>import MySQLdb
  Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "/Library/Frameworks/EPD64.framework/Versions/6.3/lib/python2.6/site-packages/MySQL_python-1.2.3-py2.6-macosx-10.5-x86_64.egg/MySQLdb/__init__.py", line 19, in &lt;module&gt;
  import _mysql
  ImportError: dlopen(/Library/Frameworks/EPD64.framework/Versions/6.3/lib/python2.6/site-packages/MySQL_python-1.2.3-py2.6-macosx-10.5-x86_64.egg/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
  Referenced from: /Library/Frameworks/EPD64.framework/Versions/6.3/lib/python2.6/site-packages/MySQL_python-1.2.3-py2.6-macosx-10.5-x86_64.egg/_mysql.so
  Reason: image not found
  </code></pre>
  
  <p>I followed the instructions on <a href="https://stackoverflow.com/questions/1448429/how-to-install-mysqldb-python-data-access-library-to-mysql-on-mac-os-x">this question</a> for cleaning up and reinstalling my MySQLdb installation.  Everything worked fine going through the steps, but it resulted in the same error.  </p>
  
  <p>I'm also not sure why it's calling the EPD64.framework directory -- the module folder and contents are actually contained in /Library/Frameworks/Python.Framework/.../site-packages.  Could MacPorts have crossed the wires somewhere?</p>
  
  <p>(I did one extra step of modifying the msyql_config path in site.cfg to /user/local/mysql/bin/mysql_config)</p>
  
  <p>I also tried to follow the advice of <a href="https://stackoverflow.com/questions/4730787/python-import-mysqldb-error-mac-10-6">this question</a> but can't find the /User/$User/.python-eggs directory at all, so not sure what to do about that.</p>
  
  <p>Any ideas?</p>