ImportError: cannot import name ‘MigrateCommand‘ from ‘flask_migrate‘


FLASK下执行数据库升级时,

ImportError: cannot import name 'MigrateCommand' from 'flask_migrate' (venv3\lib\site-packages\flask_migrate\__init__.py)

官方答复:
https://github.com/miguelgrinberg/Flask-Migrate/issues/406
Owner
@miguelgrinberg miguelgrinberg commented on 18 May
Flask-Script is not supported anymore. You have to use an older release, or else migrate to the Flask CLI.

既然这样,只能像亿万千百度大咖们说的:回退版本


pip3 install flask-migrate==8.0.6
ERROR: Could not find a version that satisfies the requirement flask-migrate==8.0.6 (from versions: 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 1.0.0, 1.1.0, 1.1.1, 1.2.0, 1.3.0, 1.3.1, 1.4.0, 1.5.0, 1.5.1, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.1.0, 2.1.1, 2.2.0, 2.2.1, 2.3.0, 2.3.1, 2.4.0, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0, 2.7.0, 3.0.0, 3.0.1, 3.1.0)
ERROR: No matching distribution found for 

退版本,一直到:
pip3 install flask-migrate==2.7.0

错误提示改为:
\venv3\lib\site-packages\sqlalchemy\dialects\mysql\pymysql.py", line 68, in dbapi
    return __import__("pymysql")
ModuleNotFoundError: No module named 'pymysql'

缺啥补啥:
pip3 install pymysql

错误提示:ERROR [flask_migrate] Error: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods

继续补:
pip3 install cryptography

直到:
python migrate_db.py db migrate执行正常

INFO  [alembic.env] No changes in schema detected.

你可能感兴趣的:(解决问题,flask,python)