Home  >  Article  >  Database  >  How to Fix "ImportError: dlopen(...: Library not loaded: libmysqlclient.16.dylib)" in Python on Mac 10.6?

How to Fix "ImportError: dlopen(...: Library not loaded: libmysqlclient.16.dylib)" in Python on Mac 10.6?

Linda Hamilton
Linda HamiltonOriginal
2024-11-07 09:54:03435browse

How to Fix

Python import MySQLdb Error on Mac 10.6

Problem:

Attempts to import the MySQLdb python plugin into a python terminal result in the following error:

ImportError: dlopen(/Users/yanigisawa/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.16.dylib

Previously Attempted Solutions:

  • Followed instructions in Stack Overflow question 4559699
  • Applied workaround mentioned in MySQL bug 59006

Workaround for Python on Mac 10.6:

To resolve the issue, add the following symbolic links:

sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql

The above is the detailed content of How to Fix "ImportError: dlopen(...: Library not loaded: libmysqlclient.16.dylib)" in Python on Mac 10.6?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn