ImportError: No module named 'Crypto.HASH' but pycryto installed
ImportError: No module named 'Crypto.HASH' but pycryto installed
我正在尝试加载 pycrypto 模块。当我做
import Crypto
我没有收到任何错误,但是当我从 Crypto.HASH import SHA256
开始时,我得到 ImportError
>>> import Crypto
>>> hash = SHA256.new()
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
hash = SHA256.new()
NameError: name 'SHA256' is not defined
>>> from Crypto.HASH import SHA256
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
from Crypto.HASH import SHA256
ImportError: No module named 'Crypto.HASH'
>>>
OS : Windows 8
Python : 3.5 32 位
谢谢。
你拼错了,正确的模块名称是Crypto.Hash
:
>>> from Crypto.Hash import SHA256
>>> h=SHA256.new()
>>> h.update(b"Hello")
>>> h.hexdigest()
'185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969'
我正在尝试加载 pycrypto 模块。当我做
import Crypto
我没有收到任何错误,但是当我从 Crypto.HASH import SHA256
开始时,我得到 ImportError
>>> import Crypto
>>> hash = SHA256.new()
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
hash = SHA256.new()
NameError: name 'SHA256' is not defined
>>> from Crypto.HASH import SHA256
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
from Crypto.HASH import SHA256
ImportError: No module named 'Crypto.HASH'
>>>
OS : Windows 8 Python : 3.5 32 位
谢谢。
你拼错了,正确的模块名称是Crypto.Hash
:
>>> from Crypto.Hash import SHA256
>>> h=SHA256.new()
>>> h.update(b"Hello")
>>> h.hexdigest()
'185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969'