Traceback (most recent call last):
File "D:/code/p11/sylpro/main.py", line 2, in <module>
from flask_migrate import Migrate,MigrateCommand
ImportError: cannot import name 'MigrateCommand'
當(dāng)遇到以上問題時(shí),在已經(jīng)確定了版本問題后,需要替換pip庫版本
此時(shí)需要將版本切換過來,舉例如下:文章來源:http://www.zghlxwxcb.cn/news/detail-736965.html
(venv) D:\code\p11\sylpro>pip install flask_script flask_migrate
....
(venv) D:\code\p11\sylpro>pip install flask-migrate==2.7.0
....
Installing collected packages: flask-migrate
Attempting uninstall: flask-migrate
Found existing installation: Flask-Migrate 4.0.1
Uninstalling Flask-Migrate-4.0.1:
Successfully uninstalled Flask-Migrate-4.0.1
Successfully installed flask-migrate-2.7.0
由上面額案例可以看出,在已經(jīng)安裝了flask-migrate較高本之后在安裝相對低版本的,直接在后面接上*==版本號*,pip系統(tǒng)將直接強(qiáng)制卸載之前的版本,然后繼續(xù)安裝當(dāng)前制定版本。文章來源地址http://www.zghlxwxcb.cn/news/detail-736965.html
到了這里,關(guān)于Python:關(guān)于pip安裝指定版本的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!