没有名为MySQLdb的模块错误

时间:2015-01-21 11:59:35

标签: python macos mysql-python

当我使用python控制台并使用

import MySQLdb

没有错误发生。 当我使用bash脚本

#!/usr/bin/python
import MySQLdb

我收到以下错误

 File "./jaccard.py", line 2, in <module>
 import MySQLdb
 ImportError: No module named MySQLdb

打印sys.path

 import sys; print(sys.path) 

输出

'/Users/kinetechsolutions/Dropbox/Code', '/Library/Python/2.7/site-packages/pip-1.3.1-py2.7.egg', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages'

MySQLdb.__file__

崩溃了python的命令行

0 个答案:

没有答案