Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6565409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:05:26+00:00 2026-05-25T14:05:26+00:00

I have been running python from a brew install. I went to install the

  • 0

I have been running python from a brew install. I went to install the mysql_python egg with setup tools (standard install according to mysql_python instructions) and it installed to /usr/local/lib/python2.7/site-packages/. The dependencies processed, etc.

Then I went to run python console. I can import other things (e.g. import django; print django.VERSION works) but when I import MySQLdb, I get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Cellar/python/2.7.1/lib/python2.7/site-packages/MySQL_python-1.2.3-py2.7-macosx-10.4-x86_64.egg/MySQLdb/__init__.py", line 19, in <module>
    import _mysql
ImportError: dlopen(/usr/local/Cellar/python/2.7.1/lib/python2.7/site-packages/MySQL_python-1.2.3-py2.7-macosx-10.4-x86_64.egg/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
  Referenced from: /usr/local/Cellar/python/2.7.1/lib/python2.7/site-packages/MySQL_python-1.2.3-py2.7-macosx-10.4-x86_64.egg/_mysql.so
  Reason: image not found

Any insight? Thanks much.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:05:26+00:00Added an answer on May 25, 2026 at 2:05 pm

    In trying to duplicate your error I did the following (I assume, being a homebrewer, you have done the same).

    1) brew install python To install Python 2.7
    2) brew install mysql To install mysql to the system (needed for various drivers)
    3) Configured mysql per homebrew’s recommendations
    4) Downloaded mysql_python and unzipped it
    5) Installed mysql_python using python setup.py install
    6) Tested it in an interactive session python, import _mysql

    After walking through these steps on Lion, I was unable to reproduce your error. Now… on to debugging your issue.

    A few things to check:
    1) In your terminal when you type which python does it point to your homebrew install?
    2) Keep in mind that with homebrew the site-packages are not stored in the Cellar they are stored in /usr/local/lib/python2.7/site-packages. See this post for more info on why. I have not had to add the site-packages’ location to my PATH, but you might give that a try.
    3) The last thing I could suggest to try is in order to get easy_install to work with homebrew’s python I had to add /usr/local/share/python to my PATH.

    EDIT
    After re-reading the error messages mainly after scrolling all the way to the right, I noticed that it was unable to load a mysql library. A quick google search on that library made it seem that when installing mysql on OS X there can be difficulties linking to it. Try and locate the file libmysqlclient.18.dylib and note down it’s path. After installing mysql via homebrew mine is : /usr/local/Cellar/mysql/5.5.14/lib. The common fix I have seen fix the environment variable DYLD_LIBRARY_PATH. For more information where I got this check out this site. Using my path’s as an example I would add this line to my .bash_profile

    export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/local/Cellar/mysql/5.5.14/lib"

    If this does not work for you, I would strongly look into the possibility that mysql isn’t installed correctly or is having issues. With that mindset hopefully something will pop out at your.

    Lastly, if you do not have any sql databaes yet, might I suggest uninstalling mysql and installing it via homebrew? I am now having zero trouble with that setup.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been developing under Python/Snowleopard happily for the part 6 months. I just
I have a Django project where I have been logging to a file using
I've been trying to add the django-lean app to my project. The django-lean app
I have just started working at a new place and they don't have any
I am using Eclipse as a Python IDE. Is there anyway for me to
Is there a way to make Python ignore any .pyc files that are present
I'm writing some unittests for code written by someone else here at the office.
This relates to a project to convert a 2-way ANOVA program in SAS to
I've taken to putting module code directly in a packages __init__.py , even for
I got a project in mind that makes it worth to finally take the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.