AttributeError:'CbcMode'对象在pyinstaller上没有属性'key'

时间:2018-11-13 17:33:46

标签: python-3.4 pyinstaller pycryptodome

我正在尝试使用.spec文件编译exe。 将pycryptodome用作block_cipher时出现问题。 错误是:

  File "c:\python\python34\lib\site-packages\PyInstaller\building    \build_main.py", line 218, in __init__
    logger.info('Will encrypt Python bytecode with key: %s', cipher.key) 
AttributeError: 'CbcMode' object has no attribute 'key'

.spec代码:

# -*- mode: python -*-
from Crypto.Cipher import AES
key = b'0123456789012345'
block_cipher = AES.new(key, AES.MODE_CBC)
a = Analysis(['asd\\xprueba.py'],
         pathex=['C:\\Python\\Python34\\Scripts'],
         binaries=[],
         datas=[],
         hiddenimports=[],
         hookspath=[],
         runtime_hooks=[],
         excludes=[],
         win_no_prefer_redirects=False,
         win_private_assemblies=False,
         cipher=block_cipher,
         noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
         cipher=block_cipher)
exe = EXE(pyz,
      a.scripts,
      a.binaries,
      a.zipfiles,
      a.datas,
      [],
      name='xprueba',
      debug=False,
      bootloader_ignore_signals=False,
      strip=False,
      upx=True,
      runtime_tmpdir=None,
      console=True )

我使用:

Python 3.4.4

windows 10 x64

Pyinstaller 3.4

Pycryptodome 3.7

有什么想法吗?

0 个答案:

没有答案