且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ModuleNotFoundError:没有名为"MySQLdb"的模块

更新时间:2021-08-20 22:27:09

我已阅读到python3不支持mysqldb

I have read that mysqldb is not supported by python3

看起来,当您尝试连接数据库时,默认情况下使用的是mysql db连接数据库!

And it looks like when you are trying to connect to your database you are using mysql db to connect to the database by default!

您需要通过编辑DATABASE_URI配置进行更改

但是在您需要安装连接器扩展之前:

But before you need to install the connector extension :

使用此命令:

pip install mysql-connector-python

根据此文档,您可以编辑DATABSE_URI并更改默认的连接器,如下所示:

And according to this documentation you can edit your DATABSE_URI and change the default connector like this :

DATABSE_URI='mysql+mysqlconnector://{user}:{password}@{server}/{database}'.format(user='your_user', password='password', server='localhost', database='dname')

我希望这会有所帮助...

I hope this will help...