二进制构建(_AES)上的Python ImportError

问题描述 投票:1回答:1

我正在使用pycrypto模块加密文件,当使用python代码运行代码时,它运行良好:

$ python encrypt_file.py file

但是在将encrypt_file.py构建为二进制时:

$ pyinstaller -F zip_disk.py

并在dist下运行二进制文件>

$ ./encrypt_file file

引发错误:

File "<string>", line 24, in <module>
File "/usr/local/lib/python2.7/dist-packages/PyInstaller-2.1-py2.7.egg/PyInstaller/loader/pyi_importers.py", line 270, in load_module
exec(bytecode, module.__dict__)
File "/home/xxxx/zip_disk/build/zip_disk/out00-PYZ.pyz/Crypto.Cipher.AES", line 50, in <module>
ImportError: cannot import name _AES

为什么会这样?如何修复二进制版本ImportError

  • 我的导入语句为from Crypto.Cipher import AES
  • python版本:Python 2.7.6
  • 我的PyCrypto版本为2.6.1。我尝试从源代码并通过pycrypto安装pip,两者都相同ImportError
  • 平台:Linux ubuntu 3.13.0-32-通用x86_64 x86_64 GNU / Linux

[我正在使用pycrypto模块加密文件,当使用python代码运行代码时,它运行良好:$ python crypto_file.py文件,但是当将crypto_file.py构建为二进制文件时:$ pyinstaller -F zip_disk.py和...] >

python importerror pyinstaller pycrypto
1个回答
0
投票

转到位置:

_Your_module_location_\Crypto\Cipher
© www.soinside.com 2019 - 2024. All rights reserved.