模块未找到错误:没有名为'bcrypt'的模块



我在尝试使用烧瓶时遇到了一些问题。请完整阅读此内容,它并不像安装烧瓶那么简单。所以我的操作系统:Win10 IDE:PyCharm版本:2019.3。好吧,我到了合并我的sqlite数据库并直接向其添加用户的地步。我需要安装 flask-bcrypt 来散列密码并存储在数据库中。我在 C: 上打开了一个 cmd 并输入pip install flask-bcrypt吐出以下错误:

命令 "C:\Users\onyxb\PycharmProjects\DIRT\venv\Scripts\python.exe C:\Users\onyxb\PycharmProjects\DIRT\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip install --ignore-in 停滞 --no-user --前缀 C:\Users\onyxb\AppData\Local\Temp\pip-build-env-e6sok_m_\overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pyp i.org/simple -- 设置工具>=40.8.0 轮子 "CFFI>=1.1;python_implementation != 'PyPy'" 失败,错误代码 1 在"无"中

当这不起作用时,我用谷歌搜索并发现人们建议使用管理员权限运行它。 所以我以管理员身份打开 cmd 并在项目目录中运行相同的命令。 它说它有效。我也认为它确实如此,但它似乎只能部分工作(让我解释一下(。如果我打开一个cmd并从python终端运行密码哈希,它可以工作,但是从Jet Brains它说以下内容:

(venv) C:UsersonyxbPycharmProjectsDIRT>python run.py
bcrypt is required to use Flask-Bcrypt
Traceback (most recent call last):
File "run.py", line 1, in <module>
from DIRT import app
File "C:UsersonyxbPycharmProjectsDIRTDIRT__init__.py", line 3, in <module>
from flask_bcrypt import Bcrypt
File "C:UsersonyxbPycharmProjectsDIRTvenvlibsite-packagesflask_bcrypt-0.7.1-py3.8.eggflask_bcrypt.py", line 27, in <module>
raise e
File "C:UsersonyxbPycharmProjectsDIRTvenvlibsite-packagesflask_bcrypt-0.7.1-py3.8.eggflask_bcrypt.py", line 24, in <module>
import bcrypt
ModuleNotFoundError: No module named 'bcrypt'

但是,当我转到我的__init__.py时,我可以通过键入fla来判断它是安装的,然后其余的(flask-bcrypt(在智能感知中弹出,导入语句之后的Bcrypt也是如此。我一定安装不正确,所以我不明白发生了什么,我感谢任何帮助。我也尝试了easy_install flask-bcrypt这也给了我安装以下内容的错误

(venv) C:UsersonyxbPycharmProjectsDIRT>easy_install flask-bcrypt
Searching for flask-bcrypt
Best match: flask-bcrypt 0.7.1
Processing flask_bcrypt-0.7.1-py3.8.egg
flask-bcrypt 0.7.1 is already the active version in easy-install.pth
Using c:usersonyxbpycharmprojectsdirtvenvlibsite-packagesflask_bcrypt-0.7.1-py3.8.egg
Processing dependencies for flask-bcrypt
Searching for bcrypt
Reading https://pypi.org/simple/bcrypt/
Downloading https://files.pythonhosted.org/packages/fa/aa/025a3ab62469b5167bc397837c9ffc486c42a97ef12ceaa6699d8f5a5416/bcrypt-3.1.7.tar.gz#sha256=0b0069c752ec14172c5f78208f
1863d7ad6755a6fae6fe76ec2c80d13be41e42
Best match: bcrypt 3.1.7
Processing bcrypt-3.1.7.tar.gz
Writing C:UsersonyxbAppDataLocalTempeasy_install-ggxvm9mcbcrypt-3.1.7setup.cfg
Running bcrypt-3.1.7setup.py -q bdist_egg --dist-dir C:UsersonyxbAppDataLocalTempeasy_install-ggxvm9mcbcrypt-3.1.7egg-dist-tmp-1tk8qkf0
_configtest.c
_cffi_backend.c
c:usersonyxbappdatalocalprogramspythonpython38includepyconfig.h(206): fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory
error: Setup script exited with error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2

任何帮助将不胜感激。顺便说一句,我确实安装了构建工具Microsoft Visual Studio C++ 14.0Jet Brains说它需要它。

您需要安装flask_bcrypt您可以使用以下命令进行操作:-

pip install flask-bcrypt

最新更新