在安装 MySQLdb 时遇到了很大的麻烦(由于 32 位和 64 位架构之间的不兼容),我现在遇到了另一个奇怪的问题,我在网上找不到解决方案。
import MySQLdb
在中工作正常,ipython qtconsole
但在ipython notebook
. 在后者中,我收到以下错误:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-dd22983d5391> in <module>()
----> 1 import MySQLdb
/Users/username/anaconda/lib/python2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.5-x86_64.egg/MySQLdb/__init__.py in <module>()
17 from MySQLdb.release import __version__, version_info, __author__
18
---> 19 import _mysql
20
21 if version_info != _mysql.version_info:
ImportError: dlopen(/Users/username/anaconda/lib/python2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.5-x86_64.egg/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Users/username/anaconda/lib/python2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.5-x86_64.egg/_mysql.so
Reason: image not found
libmysqlclient.18.dylib
位于$DYLD_LIBRARY_PATH
.
例如:$echo $DYLD_LIBRARY_PATH
退货
:/usr/local/mysql/lib/:/usr/local/mysql/lib/
有什么想法可以解决这个问题,或者这是否是ipython notebook
错误。