简介
pycrypto包含安全散列函数的集合(例如SHA256和RIPEMD160)和各种加密算法(AES, DES, RSA, ElGamal,etc等)
安装问题
在mac环境下直接使用pip安装出现以下错误信息:
src/_fastmath.c:36:11: fatal error: 'gmp.h' file not found
# include <gmp.h>
^~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
build/temp.macosx-10.14-x86_64-3.7/_openssl.c:483:10: fatal error: 'openssl/opensslv.h' file not found
#include <openssl/opensslv.h>
^~~~~~~~~~~~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
解决
提示缺少gmp.h
和opensslv.h
,GMP是一个任意精度的开源算术库,可用于符号整数,有理数,浮点数计算。OpenSSL 是一个用C语言实现的SSL协议软件包。安装这两个并增加环境变量即可:
brew install gmp
brew install openssl
export "CFLAGS=-I/usr/local/include -L/usr/local/lib"
export "LDFLAGS=-L/usr/local/opt/openssl/lib"
export "CPPFLAGS=-I/usr/local/opt/openssl/include"
然后直接使用pip安装即可