0

I recently upgraded Linux Mint to 19.1 X64 with Python 3.6 from Linux Mint 18.3 X64 (with Python 3.5.2), and tried

from Crypto.Cipher import AES

I first got,

ImportError: No module named apt_pkg

fixed it by

sudo ln -s apt_pkg.cpython-{36m,35m}-x86_64-linux-gnu.so

in /usr/lib/python3/dist-packages;

then got another error,

ImportError: cannot import name '_AES'

I am wondering how to fix it. The interpreter for the project in PyCharm is currently set to Python 3.5.2;

daiyue
  • 7,196
  • 25
  • 82
  • 149

1 Answers1

0

Most likely, your PyCrypto installation is broken and _AES.dll is missing. The reason might be that your computer is 64 bit but the Crypto which is 32 bit was downloaded by pip. Try to reinstall it according to this question: How do I install PyCrypto on Windows?

Alternatively, you can download Crypto 64 bit from here: https://github.com/BConcernedOnFamily/Crypto_64bit with the fix and add the files my github downloaded to the corresponding location under your python3/Lib.

Rene B.
  • 6,557
  • 7
  • 46
  • 72
  • I understood I already have `_raw_aes.cp37-win_amd64.pyd` but I still get `ImportError: cannot import name 'AES' from 'Crypto.Cipher' (unknown location)` – Farhang Amaji Jul 19 '21 at 18:54