ImportError:即使安装了Mysqldb,也没有名为MySQLdb的模块

时间:2015-06-04 14:05:18

标签: python mysql mysql-python

所以我在Linux上安装了Mysql。之后我使用命令sudo apt-get install python-mysqldb安装了mysqldb。然后,当我尝试在python中导入它时,我得到错误“ImportError:没有名为MySQLdb的模块”。我甚至重新启动了所有。我正在运行python 2.7。在开始这项工作之前,我还需要做些什么吗?有什么建议吗?在此先感谢!!

>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named MySQLdb

pip冻结的输出是

Cython==0.21
DataShape==0.3.0
Flask==0.10.1
Jinja2==2.7.3
MarkupSafe==0.23
PIL==1.1.7
PyYAML==3.11
Pygments==1.6
SQLAlchemy==0.9.7
Sphinx==1.2.3
Theano==0.6.0
Werkzeug==0.9.6
XlsxWriter==0.5.7
abstract-rendering==0.5.1
argcomplete==0.8.1
astropy==0.4.2
atom==0.3.9
backports.ssl-match-hostname==3.4.0.2
beautifulsoup4==4.3.2
binstar==0.7.1
bitarray==0.8.1
blaze==0.6.3
blz==0.6.2
bokeh==0.6.1
boto==2.32.1
casuarius==1.1
cdecimal==2.3
cffi==0.8.6
chaco==4.4.1
colorama==0.3.1
conda==3.7.0
conda-build==1.8.2
configobj==5.0.6
cryptography==0.5.4
cytoolz==0.7.0
decorator==3.4.0
docutils==0.12
enable==4.3.0
enaml==0.9.8
future==0.13.1
futures==2.1.6
gensim==0.10.3
gevent==1.0.1
gevent-websocket==0.9.3
greenlet==0.4.4
grin==1.2.1
h5py==2.3.1
ipython==2.2.0
itsdangerous==0.24
jdcal==1.0
kiwisolver==0.1.3
llvmpy==0.12.7
lxml==3.4.0
matplotlib==1.4.0
mock==1.0.1
mpi4py==1.3
multipledispatch==0.4.7
networkx==1.9.1
nltk==3.0.0
nose==1.3.4
numba==0.14.0
numexpr==2.3.1
numpy==1.9.2
openpyxl==1.8.5
pandas==0.14.1
patsy==0.3.0
pep8==1.5.7
ply==3.4
psutil==2.1.1
py==1.4.25
pyOpenSSL==0.14
pycosat==0.6.1
pycparser==2.10
pycrypto==2.6.1
pycurl==7.19.5
pyface==4.4.0
pyflakes==0.8.1
pyparsing==2.0.1
pytest==2.6.3
python-dateutil==1.5
pytz==2014.7
pyzmq==14.3.1
redis==2.9.1
requests==2.4.1
rope==0.9.4
runipy==0.1.1
scikit-image==0.10.1
scikit-learn==0.15.2
scipy==0.14.0
six==1.8.0
sockjs-tornado==1.0.1
spyder==2.3.1
statsmodels==0.5.0
sympy==0.7.5
tables==3.1.1
toolz==0.7.0
tornado==4.0.2
traits==4.4.0
traitsui==4.4.0
ujson==1.33
unicodecsv==0.9.4
wsgiref==0.1.2
xlrd==0.9.3
xlwt==0.7.5

1 个答案:

答案 0 :(得分:0)

我认为你必须导入mysql python模块:

pip install MySQL-python