简体   繁体   中英

wtforms import could not be resolved

I am trying to import wtforms, flask_wtf, and others into my flask app. All other solutions are saying to make sure it is installed in the right place. When I do "py -m pip show flask_wtf, py -m pip show wtforms", it says that all of them are installed with the correct versions. When I go to env/Lib/site-packages, I have flask_wtf, wtforms, and WTForms-3.0.1dist-info, and Flask_WTf-1.1.0dev0-py3.10egg-info folders, which according to my research is where all these files are supposed to be. However, it still will not let me import these into my app, appearing white with the yellow squiggly under it. Any solutions?

enter image description here

After trying many options, I deactivated my env, ran py -m pip install Flask-WTF --upgrade (even though I believe that they were already up to date considering I just installed them), and then ran the file and it worked. The file also worked when I reactivated my env. I have no clue why this worked but it did,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM