PyCrypto导入AES问题

时间:2014-02-01 19:55:28

标签: python encryption aes pycrypto

我从Crypto.Cipher

导入AES时,第一次使用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'

有人说,安装程序有问题,但是我使用.exe安装程序来安装x64系统。 有人说,他将_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.

我不知道,如何解决这个问题,我只会描述一下我的行为:

  1. pip uninstall pycrypto
  2. pip install pycrypto(有错误)
  3. pip install --upgrade pycrypto(有错误)
  4. 下载并启动amd64的exe(链接:http://www.voidspace.org.uk/python/modules.shtml
  5. 尝试导入 - 完成!
  6. P.S。 在此操作之前,我尝试使用win32安装创建环境,但它没有帮助!

2 个答案:

答案 0 :(得分:1)

在Windows上我重新安装了PyCrypto模块(link),一切都适合我。

答案 1 :(得分:-2)

pip卸载pycrypto pip安装pycrypto(有错误) pip install --upgrade pycrypto(错误) 下载并启动amd64的exe(链接:http://www.voidspace.org.uk/python/modules.shtml) 尝试导入-完成!

为我辛苦工作是因为我在使用python 3