Solve the problem that Crypto cannot be loaded

Not much nonsense! Go ahead!
I just wrote the AES encryption and decryption process, but the Crypto library cannot recognize it.

Pay attention to the system environment

Python When using AES under Windows, you need to install the pycryptodome module pip install pycryptodome
python When using AES under Linux, you need to install the pycrypto module pip install pycrypto

I found a solution online

python3.5: ImportError: No module named Crypto.Cipher
error message:
from Crypto.Cipher import AES
ImportError: No module
named'Crypto ' windows If you directly pip install pycrypto, it usually requires the installation of the VC++ compiler, which is more troublesome.
Solution
pip install pycryptodome
After installing Windows, you need to change the c of the crypto directory under site-packages under Python to C (uppercase).
Linux can be used directly.
Once again from Crypto.Cipher import AES, it can be used normally.

Finally, the window found the system problem, and the
following modules should be introduced into the
window system

from Cryptodome.Cipher import AES
import base64

Linux system

from Crypto.Cipher import AES
import base64

Finally solved it perfectly!
Code address introduction AES encryption algorithm basics

Guess you like

Origin blog.csdn.net/weixin_37254196/article/details/108217553