When I try to run app.py (Python 3.3, PyCrypto 2.6) my virtualenv keeps returning the error listed above. My import statement is just from Crypto.Cipher import AES
On the mac... if you run into this.. try to see if you can import crypto instead?
If so.. the package name is the issue C
vs c
. To get around this.. just add these lines to the top of your script.
import crypto
import sys
sys.modules['Crypto'] = crypto
You know should be able to import paramiko successfully.
I found the solution. Issue is probably in case sensitivity (on Windows).
Just change the name of the folder:
C:\Python27\Lib\site-packages\crypto
C:\Python27\Lib\site-packages\Crypto
This is how folder was named after installation of pycrypto:
I've changed it to:
And now the following code works fine:
type command:
sudo pip install pycrypto
I solve this problem by change the first letter case to upper. Make sure ''from Crypto.Cipher import AES'' not ''from crypto.Cipher import AES''.
To date, I'm having same issue when importing from Crypto.Cipher import AES
even when I've installed/reinstalled pycrypto a few times. End up it's because pip defaulted to python3.
~ pip --version
pip 18.0 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
installing pycrypto with pip2 should solve this issue.
Well this might appear weird but after installing pycrypto
or pycryptodome
, we need to update the directory name crypto
to Crypto
in lib/site-packages
Reference