python接口自动化:python3.6中import Crypto.Hash报错的解决方案

一:问题

python3.6中算法加密引入包Crypto报错,即便安装了:

pip install crypto

pip install pycrypto

pip install pycryptodome

但是仍然悲催的发现引用是报错的:

 

二:模块说明

crypto:一个加密解密的库

pycrypto:crypto在python上面的名字是pycrypto它是一个第三方库,但是已经停止更新三年了,所以不建议安装这个库

pycrytodome:是pycrypto替代品,且可以兼容之前的pycrypto,与pycrypto不能同时安装

pycryptodomex:此版本为新版解密加密库

 

三:解决方法

可以执行如下命令:pip install pycryptodomex ,即安装新版本的加密解密库

然后引入改成如下方式:


from Cryptodome.Hash import SHA256
from Cryptodome.Cipher import AES
from Cryptodome.Cipher import DES

 ok,搞定~

posted @ 2019-09-17 16:12  秒秒开心  阅读(3365)  评论(1编辑  收藏  举报