简体   繁体   English

wtforms 导入无法解决

[英]wtforms import could not be resolved

I am trying to import wtforms, flask_wtf, and others into my flask app.我正在尝试将 wtforms、flask_wtf 等导入我的 flask 应用程序。 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.当我执行“py -m pip show flask_wtf, py -m pip show wtforms”时,它表示所有这些都安装了正确的版本。 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.当我将 go 转至 env/Lib/site-packages 时,我有 flask_wtf、wtforms 和 WTForms-3.0.1dist-info 和 Flask_WTf-1.1.0dev0-py3.10egg-info 文件夹,根据我的研究,这些文件夹在哪里文件应该是。 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.在尝试了许多选项之后,我停用了我的环境,运行 py -m pip install Flask-WTF --upgrade (即使我相信它们已经是最新的,因为我刚刚安装了它们),然后运行该文件并且它工作。 The file also worked when I reactivated my env.当我重新激活我的环境时,该文件也有效。 I have no clue why this worked but it did,我不知道为什么这有效,但确实有效,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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