ModuleNotFoundError:没有名为“Crypto”的模块错误

问题描述 投票:0回答:2

我已经在 python 3.6.5 上安装了 pycryptodomex 模块,但是当我尝试执行下面的调用时,我收到标题中提到的错误

from Crypto.Cipher import AES

我想使用 AES 加密文件。现在如何进行?

python python-3.x pycryptodome
2个回答
53
投票
>> pip install pycryptodome

from Crypto.Cipher import AES  #Works

>> pip install pycryptodomex
from Cryptodome.Cipher import AES 

对于 python3,包名称现在为 pycryptodomepycryptodomex

如果您需要与Python2的项目兼容,请使用pycryptodome,或者使用pycryptodomex,它是一个独立于旧PyCrypto的库。


13
投票

你好,我遇到了同样的问题: _几乎是旧 PyCrypto 库的直接替代品。你安装它:

$ pip install pycryptodome ((3.8.2)) 或最新版本 转到这个目录: 2) [C:\Users\s****\AppData\Local\Programs\Python\Python37-32\Lib\site-package

© www.soinside.com 2019 - 2024. All rights reserved.