且构网

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

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

更新时间:2021-08-20 22:26:45

我读到 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

根据本文档,您可以编辑您的 DATABASE_URI并像这样更改默认连接器:

And according to this documentation you can edit your DATABASE_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...