Python加密工具包pycrypto的安装

【介绍】

pycrypto是用Python写的加密工具包。

This is a collection of both secure hash functions (such as SHA256 and RIPEMD160), and various encryption algorithms (AES, DES, RSA, ElGamal, etc.).

参考:https://pypi.python.org/pypi/pycrypto

【Installation】

下载pycrypto的最新版本,地址为:

https://pypi.python.org/pypi/pycrypto

安装方法简单:you can simply run "python setup.py build" to build the package, and "python setup.py install" to install it.

但是执行python setup.py install之后,在有的windows机器上会报错,错误描述是这样的“Warning:GMP or MPIR librariy not found;Not building Crypto.PublicKey._fastmath. ”和“error: Unable to find vcvarsall.bat”。截图如下:

 

这是由于vcvarsall.bat is a part of MS Visual Studio. You need either VS2008 or MinGW32 to compile the sources of Windows。就是说这个源码需要vs2008进行编译才能安装,而你的机器上没有安装vs2008。

为了解决这个问题,你可以安装一个VS2008,但是安装vs2008比较费时间。一个比较好的办法就是拿一个编译好的pycrypto来进行安装。正好网上可以找到预编译的pycrypto安装文件。

地址为:http://www.voidspace.org.uk/python/modules.shtml

下载你所需要的版本,像安装其他windows应用程序一样,“下一步”“下一步”按照默认配置安装完成即可。

【Practice】

An example usage of an encryption algorithm (AES, in this case) is:

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值