无法在 Python 3.9 上使用 Poetry 安装加密包

时间:2021-04-08 05:52:03

标签: python-poetry python-cryptography

当我尝试在 Python 3.9.0 虚拟环境中使用 Python Poetry 1.1.4 包管理器 (poetry add cryptography) 安装加密模块时,我得到:

    error: can't find Rust compiler
    
    If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.
    
    To update pip, run:
    
        pip install --upgrade pip
    
    and then retry package installation.
    
    If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
    
    This package requires Rust >=1.41.0.
    ----------------------------------------
    ERROR: Failed building wheel for cryptography
  Failed to build cryptography
  ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly

虽然我使用的是 pip 21.0.1(最新),但我对 Python 3.8 没有任何问题。

知道为什么以及如何解决这个问题吗?最新的加密模块信息显示 it's compatible with Python 3.6+

1 个答案:

答案 0 :(得分:0)

如果没有 cryptography 可用于您的平台,则较新版本的 wheel 要求 Rust 从 sdist 构建 wheel

见:https://github.com/pyca/cryptography/issues/5771