ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly

  • Post author:
  • Post category:其他

问题描述

最近在ubuntu16.04上安装pwntools卡到一个问题,报错提示如下:

ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly

发现是build cryptography的时候出错,百度搜索的结果中没一个顶用的,最终在stackoverflow上找到了解决方案。

解决方案

本质上就是要build cryptography,当你环境中有c编译器时直接一条命令即可解决,因此注意先保证安装了gcc

sudo apt install gcc  # ubuntu
sudo yum install gcc  # centos

然后直接一条命令build cryptography

sudo apt-get install build-essential libssl-dev libffi-dev python-dev  # ubuntu
sudo yum install gcc libffi-devel python-devel OpenSSL-devel  # centos

接着执行

pip install cryptography

最后再尝试pip install <package>即可

注意:本方法还适用其他安装pwntools时出现的问题

参考资料

  • https://stackoverflow.com/questions/22073516/failed-to-install-python-cryptography-package-with-pip-and-setup-py

版权声明:本文为GentleCP原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。