本文介绍了Python MySQLdb无法导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经使用安装了mysql服务器
I have installed mysql server using
$ sudo apt-get install mysql-server
然后我使用以下命令安装了python-mysqldb
then I installed python-mysqldb using
$ sudo apt-get install python-mysqldb
但是当我在python中导入MySQLdb时,显示以下错误
but when I import MySQLdb in python it shows the following error
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named MySQLdb
我重新安装了mysql服务器和python-mysqldb,但显示相同的错误.我怎么了?
I reinstalled both mysql server and python-mysqldb but it shows the same error. What am I getting wrong?
推荐答案
您需要使用pip pip install mysql-python
这篇关于Python MySQLdb无法导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!