ModuleNotFoundError: No module named 'MySQLdb' 和 FSA DeprecationWarning: SQLALCHEMY_TRACK_MODIFICAT

 1. 在python shell经过 Flask-SQLAlchemy对象初始化数据库和数据表时报一下错误

>>> from yourapplication import db   # 导入SQLAlchemy的对象db
>>> db.create_all()
C:\Users\allar\Envs\wangyinews\lib\site-packages\flask_sqlalchemy\__init__.py:835: FSA

DeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will

be disabled by default in the future. Set it to True or False to suppress this warning. 'SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and '

    意思是: DeprecationWarning: sqlalchemy_track_changes增长了大量开销未来默认禁用。将其设置为True或False以抑制此警告。sqlalchemy_track_modify增长了很大的开销python

按照下面操做就能够关闭警告:mysql

打开上面路径下的文件__init__.py修改为如下内容:

track_modifications = app.config.setdefault(

'SQLALCHEMY_TRACK_MODIFICATIONS', True

)

2.ModuleNotFoundError: No module named 'MySQLdb'

    缺乏mysql的链接驱动,安装mysqlclient就行,还有其它许多方法知道一种就行sql

(wangyinews) C:\Users\allar\Desktop\WangYinews>pip install mysqlclient