ERROR: Failed building wheel for cryptography
debian下python3.9安装cryptography报错
完整错误信息:
running build_rust
=============================DEBUG ASSISTANCE=============================
If you are seeing a compilation error please try the following steps to
successfully install cryptography:
1) Upgrade to the latest pip and try again. This will fix errors for most
users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
2) Read https://cryptography.io/en/latest/installation.html for specific
instructions for your platform.
3) Check our frequently asked questions for more information:
https://cryptography.io/en/latest/faq.html
4) Ensure you have a recent Rust toolchain installed:
https://cryptography.io/en/latest/installation.html#rust
5) If you are experiencing issues with Rust for *this release only* you may
set the environment variable `CRYPTOGRAPHY_DONT_BUILD_RUST=1`.
=============================DEBUG ASSISTANCE=============================
error: Can not find Rust compiler
----------------------------------------
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
首先确保一些依赖包已经正常安装
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus
sudo apt-get install build-essential libncursesw5-dev libgdbm-dev libc6-dev
sudo apt-get install zlib1g-dev libsqlite3-dev tk-dev
sudo apt-get install libssl-dev openssl
sudo apt-get install libffi-dev
确认依赖没问题后可以尝试以下三种解决方式:
- 升级pip后再试
python -m pip install --upgrade pip
如果发现升级失败可以删除
"/你的安装目录/site-packages/pip-你的版本号.dist-info" 目录重新执行 python -m pip install --upgrade pip 再试
- 先安装pep517再安装cryptography
pip install pep517
pip install cryptography
- 直接忽略build rust编译器
export CRYPTOGRAPHY_DONT_BUILD_RUST=1
pip install cryptography