PyCharm中没有名为flask-wtf的模块[重复]

Posted

技术标签:

【中文标题】PyCharm中没有名为flask-wtf的模块[重复]【英文标题】:No module named flask-wtf in PyCharm [duplicate] 【发布时间】:2021-11-12 08:16:02 【问题描述】:

当我运行这段代码时,from flask_wtf import FlaskForm 出现错误,

File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'flask_wtf'

我已经通过CMD安装了flask-wtf包,

pip install flask-wtf

它让我确认包已成功安装

Requirement already satisfied: flask-wtf in c:\users\zzz\appdata\local\programs\python\python37\lib\site-packages (0.15.1)
Requirement already satisfied: WTForms in c:\users\zzz\appdata\local\programs\python\python37\lib\site-packages (from flask-wtf) (2.3.3)
Requirement already satisfied: Flask in c:\users\zzz\appdata\local\programs\python\python37\lib\site-packages (from flask-wtf) (2.0.1)
Requirement already satisfied: itsdangerous in c:\users\zzz\appdata\local\programs\python\python37\lib\site-packages (from flask-wtf) (2.0.1)
Requirement already satisfied: Jinja2>=3.0 in c:\users\zzz\appdata\local\programs\python\python37\lib\site-packages (from Flask->flask-wtf) (3.0.1)
Requirement already satisfied: Werkzeug>=2.0 in c:\users\zzz\appdata\local\programs\python\python37\lib\site-packages (from Flask->flask-wtf) (2.0.1)
Requirement already satisfied: click>=7.1.2 in c:\users\zzz\appdata\local\programs\python\python37\lib\site-packages (from Flask->flask-wtf) (8.0.1)
Requirement already satisfied: colorama in c:\users\zzz\appdata\local\programs\python\python37\lib\site-packages (from click>=7.1.2->Flask->flask-wtf) (0.4.4)
Requirement already satisfied: importlib-metadata in c:\users\zzz\appdata\local\programs\python\python37\lib\site-packages (from click>=7.1.2->Flask->flask-wtf) (4.8.1)
Requirement already satisfied: MarkupSafe>=2.0 in c:\users\zzz\appdata\local\programs\python\python37\lib\site-packages (from Jinja2>=3.0->Flask->flask-wtf) (2.0.1)
Requirement already satisfied: typing-extensions>=3.6.4 in c:\users\zzz\appdata\local\programs\python\python37\lib\site-packages (from importlib-metadata->click>=7.1.2->Flask->flask-wtf) (3.10.0.2)
Requirement already satisfied: zipp>=0.5 in c:\users\zzz\appdata\local\programs\python\python37\lib\site-packages (from importlib-metadata->click>=7.1.2->Flask->flask-wtf) (3.5.0)

【问题讨论】:

在 pycharm 中,您是否在处理虚拟环境?那么您的 pkg 需要安装在该虚拟环境上。例如,如果我在 venv(作为虚拟 env)中,那么我可以使用 pip freeze 找到已安装的软件包。 (venv) (base) user@users-iMac SOtry % ` pip freeze`。 问题是你试图在没有激活正确的 venv 的情况下进行 pip 安装。 pip 输出显示您正在尝试安装到已经具有某个版本的包或其依赖项的 Python 基础安装。 【参考方案1】:

通过直接从 PyCharm 安装 flask-wtf 包修复。

ctrl + alt+ S 然后Python Interpreters 点击+ 符号,然后输入flask-wtf 并下载包。

【讨论】:

以上是关于PyCharm中没有名为flask-wtf的模块[重复]的主要内容,如果未能解决你的问题,请参考以下文章

PyCharm 中没有名为 kivy 的模块

Pycharm 中没有名为“pandas”的模块

Colab 中没有名为“statsmodels.tsa.arima”的模块,但 Pycharm 中没有

PyCharm 2017.1,没有名为“kivy”的模块

ModuleNotFoundError:PyCharm 上没有名为“pynput”的模块错误

ImportError:没有名为“xlrd”的模块