问题描述:今天在使用Crypto.Random.random的时候出现错误,具体错误原因如下:
>>> from Crypto.Random import random
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\一\AppData\Local\Programs\Python\Python37\lib\site-packages\Crypto\Random\random.py", line 29, in <module>
from Crypto.Util.py3compat import is_native_int
ImportError: cannot import name 'is_native_int' from 'Crypto.Util.py3compat' (C:\Users\一\AppData\Local\Programs\Python\Python37\lib\site-packages\Crypto\Util\py3compat.py)
>>> from Crypto.Random import random
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\一\AppData\Local\Programs\Python\Python37\lib\site-packages\Crypto\Random\random.py", line 29, in <module>
from Crypto.Util.py3compat import is_native_int
ImportError: cannot import name 'is_native_int' from 'Crypto.Util.py3compat' (C:\Users\一\AppData\Local\Programs\Python\Python37\lib\site-packages\Crypto\Util\py3compat.py)
解决办法:卸载pycrypto,然后再以管理员身份重新安装pycrypto
pip uninstall pycrypto
pip install pycrypto