pythonpython-3.xpycryptodome

ModuleNotFoundError: No module named 'Crypto' Error


I have installed pycryptodomex module on python 3.6.5 but when i try to execute the below call, i get the error mentioned in the headline

from Crypto.Cipher import AES

I want to encrypt a file using AES. How to proceed now ?


Solution

  • >> pip install pycryptodome
    
    from Crypto.Cipher import AES  #Works
    

    or

    >> pip install pycryptodomex
    from Cryptodome.Cipher import AES 
    

    For python3 the package name is now pycryptodome or pycryptodomex

    If you need compatibility with your project with Python2 use pycryptodome or else use pycryptodomex which is a library independent of the old PyCrypto.