我第一次使用AES加密并遇到了问题,当从Crypto.Cipher
导入AES时。
Traceback (most recent call last):
File "C:\Users\gek0n\Desktop\wargames\server.py", line 8, in <module>
from Crypto.Cipher import AES
File "build\bdist.win-amd64\egg\Crypto\Cipher\AES.py", line 50, in <module>
File "build\bdist.win-amd64\egg\Crypto\Cipher\_AES.py", line 7, in <module>
File "build\bdist.win-amd64\egg\Crypto\Cipher\_AES.py", line 4, in __bootstrap__
File "build\bdist.win-amd64\egg\pkg_resources.py", line 914, in resource_filename
File "build\bdist.win-amd64\egg\pkg_resources.py", line 1601, in get_resource_filename
File "build\bdist.win-amd64\egg\pkg_resources.py", line 1629, in _extract_resource
File "build\bdist.win-amd64\egg\pkg_resources.py", line 990, in get_cache_path
AttributeError: ResourceManager instance has no attribute '_warn_unsafe_extraction'
有人说安装程序有问题,但我使用的是适用于x64系统的.exe安装程序。
有人说他将_warn_unsafe_extractor
改为不同的名称,问题就解决了,但是找不到这个文件。
现在我在重新使用PIP安装PyCrypto后出现了新的错误。
Traceback (most recent call last):
File "C:\Users\gek0n\Desktop\wargames\server.py", line 8, in <module>
from Crypto.Cipher import AES
File "C:\Python27\lib\site-packages\Crypto\Cipher\AES.py", line 50, in <module>
from Crypto.Cipher import _AES
ImportError: DLL load failed: %1 не является приложением Win32.
我不知道如何解决这个问题,我只能描述一下我的操作:
- 使用pip卸载pycrypto
- 使用pip安装pycrypto(出现错误)
- 使用pip升级pycrypto(出现错误)
- 下载并启动amd64的exe文件(链接:http://www.voidspace.org.uk/python/modules.shtml)
- 尝试导入——成功了!
P.S. 在执行上述操作之前,我尝试使用win32进行环境创建,但没有起到任何作用!