Reputation: 81
I am trying to import Crypto in my python program but i got error. i am working on windows. please help.
cmd
C:\Users\Raw.306498\Desktop>pip3 install --upgrade pycryptodome
Requirement already up-to-date: pycryptodome in c:\users\raw.306498\appdata\lo
cal\programs\python\python37\lib\site-packages (3.8.0)
C:\Users\Raw.306498\Desktop>python test.py
Traceback (most recent call last):
File "test.py", line 2, in <module>
from Crypto.Cipher import DES
ModuleNotFoundError: No module named 'Crypto'
C:\Users\Raw.306498\Desktop>
test.py
from Crypto.Util.asn1 import DerBitString
from binascii import hexlify, unhexlify
passw=b'21566572697461733131'
s = unhexlify(passw)
cred=str(s,'ascii')
Upvotes: 1
Views: 1708
Reputation: 3069
solution to this problem for windows users is explained in the documentations here and it says:
The root cause is that, in the past, you most likely have installed an unrelated but similarly named package called crypto, which happens to operate under the namespace crypto
Fix the problem with:
pip uninstall crypto
pip uninstall pycryptodome
pip install pycryptodome
more elaboration of the cause can be seen in this github issue
UPDATE:
If the solution quoted from documentation did not work you have to change the package folder name from crypto
into Crypto
.
to find where the package folder is located:
where python
.C:\Users\_YourUserName_\AppData\Local\Programs\Python\Python37-32\python.exe
cd C:\Users\_YourUserName_\AppData\Local\Programs\Python\Python37-32\
run these:
cd ..
cd cd Lib\site-packages
explorer .
Upvotes: 3
Reputation: 81
i solved this issue actually a similar named file is already store in python library so first i delete it then install pycrypto using pip
Upvotes: -1