错误:无法为使用 PEP 517 的 bcrypt 构建轮子,并且无法直接安装

问题描述 投票:0回答:8

pycharm中的解释器配置由于某种原因变得无效,所以我为我正在开发的项目创建了一个新的虚拟环境,并重新安装了依赖项。但我再次安装 bcrypt 时遇到了麻烦。这是完整的错误。该项目与以前的解释器工作得很好,所以我怀疑 python 版本与它有什么关系。我尝试安装wheel以及错误提示

could not build wheels
,但这也没有完成任务。

完整错误:

Collecting flask-bcrypt
      Using cached https://files.pythonhosted.org/packages/1d/c0/6d4c04d007d72b355de24e7a223978d1a95732245f
    9e9becbf45d3024bf8/Flask-Bcrypt-0.7.1.tar.gz
    Requirement already satisfied: Flask in c:\users\User\appdata\local\programs\python\python38-3
    2\lib\site-packages (from flask-bcrypt) (1.1.2)
    Collecting bcrypt (from flask-bcrypt)
      Using cached https://files.pythonhosted.org/packages/d8/ba/21c475ead997ee21502d30f76fd93ad8d5858d19a3
    fad7cd153de698c4dd/bcrypt-3.2.0.tar.gz
      Installing build dependencies ... done
      Getting requirements to build wheel ... done
        Preparing wheel metadata ... done
    Requirement already satisfied: Jinja2>=2.10.1 in c:\users\User\appdata\local\programs\python\p
    ython38-32\lib\site-packages (from Flask->flask-bcrypt) (2.11.2)
    Requirement already satisfied: Werkzeug>=0.15 in c:\users\User\appdata\local\programs\python\p
    ython38-32\lib\site-packages (from Flask->flask-bcrypt) (1.0.1)
    Requirement already satisfied: itsdangerous>=0.24 in c:\users\User\appdata\local\programs\pyth
    on\python38-32\lib\site-packages (from Flask->flask-bcrypt) (1.1.0)
    Requirement already satisfied: click>=5.1 in c:\users\User\appdata\local\programs\python\pytho
    n38-32\lib\site-packages (from Flask->flask-bcrypt) (7.1.2)
    Requirement already satisfied: six>=1.4.1 in c:\users\User\appdata\roaming\python\python38\sit
    e-packages (from bcrypt->flask-bcrypt) (1.15.0)
    Requirement already satisfied: cffi>=1.1 in c:\users\User\appdata\local\programs\python\python
    38-32\lib\site-packages (from bcrypt->flask-bcrypt) (1.14.2)
    Requirement already satisfied: MarkupSafe>=0.23 in c:\users\User\appdata\local\programs\python
    \python38-32\lib\site-packages (from Jinja2>=2.10.1->Flask->flask-bcrypt) (1.1.1)
    Requirement already satisfied: pycparser in c:\users\User\appdata\local\programs\python\python
    38-32\lib\site-packages (from cffi>=1.1->bcrypt->flask-bcrypt) (2.20)
    Building wheels for collected packages: bcrypt
      Building wheel for bcrypt (PEP 517) ... error
      ERROR: Command errored out with exit status 1:
       command: 'c:\users\User\appdata\local\programs\python\python38-32\python.exe' 'c:\users\User\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\pep517\_in_process.p
    y' build_wheel 'C:\conda_temp\tmpgl0zt2ul'
           cwd: C:\conda_temp\pip-install-9i9ne9yb\bcrypt
      Complete output (15 lines):
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win32-3.8
      creating build\lib.win32-3.8\bcrypt
      copying src\bcrypt\__about__.py -> build\lib.win32-3.8\bcrypt
      copying src\bcrypt\__init__.py -> build\lib.win32-3.8\bcrypt
      copying src\bcrypt\py.typed -> build\lib.win32-3.8\bcrypt
      running build_ext
      generating cffi module 'build\\temp.win32-3.8\\Release\\_bcrypt.c'
      creating build\temp.win32-3.8
      creating build\temp.win32-3.8\Release
      building '_bcrypt' extension
      error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://vi
    sualstudio.microsoft.com/downloads/
      ----------------------------------------
      ERROR: Failed building wheel for bcrypt
      Running setup.py clean for bcrypt
    Failed to build bcrypt
    ERROR: Could not build wheels for bcrypt which use PEP 517 and cannot be installed directly
    WARNING: You are using pip version 19.2.3, however version 20.2.2 is available.
    You should consider upgrading via the 'python -m pip install --upgrade pip' command.
python pycharm bcrypt
8个回答
27
投票

尝试使用这些命令:

python -m pip install --upgrade pip
python -m pip install --no-use-pep517 bcrypt

3
投票

bcrypt
现已在
Rust
中实现。从源代码构建的用户需要有一个可用的 Rust 编译器,尽管对于下载轮子的用户来说不会有任何改变。

bcrypt
开发商不再运送
manylinux2010
轮子。用户应升级到最新的
pip
,以确保这不会导致在其平台上下载轮子时出现问题或使用比
4.0.0
更旧的版本。

所以尝试一下

pip3 install -U "bcrypt<4.0.0"

2
投票

bcrypt
修复到 3.2.2(4.0.0 之前的最新版本)为我解决了这个问题。就像这里所述:

问题出现在 bcrypt 4.0.0 中,没有可用的轮子。


2
投票

我所做的可能也对你有用:

$ python -m pip install --upgrade pip
$ python -m pip install --no-use-pep517 bcrypt

并且成功了。


0
投票

将 python 从 32 版本更改为 64 版本可能是解决方案。它帮助了我。


0
投票

我能够通过升级我的 pip 版本来解决该问题:

python -m pip install --upgrade pip

之后我成功安装了flask-bcrypt包:

pip install flask-bcrypt


-1
投票

尝试

pip install pep517

PIP 非常不可靠,它在 python 下需要超过 350 个不同的包,还有系统


-1
投票

我下载并安装了

“微软 Visual C++ 构建工具” https://go.microsoft.com/fwlink/?LinkId=691126

然后重新启动计算机并为我工作。

© www.soinside.com 2019 - 2024. All rights reserved.