成功安装包(Bcrypt)但仍然报错

Successfully installed package (Bcrypt) but still gives error

我成功安装了 Bcrypt 但它仍然报错(好像什么都没发生):

from flask_bcrypt import Bcrypt

问题:

Traceback (most recent call last):
  File "*path*", line 9, in <module>
from flask_bcrypt import Bcrypt
ModuleNotFoundError: No module named 'flask_bcrypt'

从图像看来您正在使用 Pycharm,请确保安装特定于该虚拟环境的 flask_bcrypt。打开终端和 pip install flask-bcrypt

并将导入语句更改为

from flask import Flask
from flask.ext.bcrypt import Bcrypt

-来自docs