Imported module not found in PyInstaller

前端 未结 7 2057
一整个雨季
一整个雨季 2020-12-01 15:21

I\'m working in Windows, using PyInstaller to package a python file. But some error is occuring:

Traceback (most recent call last):
  File \"<         


        
7条回答
  •  没有蜡笔的小新
    2020-12-01 15:47

    Had similar issues. Here's my fix for PyQt5, cffi, python 3.4.3:

    This fixes the 'sip' not found error and the '_cffi_backend' one if that comes up:

    # -*- mode: python -*-
    
    block_cipher = None
    
    
    a = Analysis(['LightShowApp.py'],
                 pathex=['c:\\MyProjects\\light-show-editor-36',
                 'c:\\Python34\\libs\\', 'c:\\Python34\\Lib\\site-packages'],
                 binaries=None,
                 datas=None,
                 hiddenimports=['sip', 'cffi'],
                 hookspath=[],
                 runtime_hooks=[],
                 excludes=[],
                 win_no_prefer_redirects=False,
                 win_private_assemblies=False,
                 cipher=block_cipher)
    pyz = PYZ(a.pure, a.zipped_data,
                 cipher=block_cipher)
    exe = EXE(pyz,
              a.scripts,
              a.binaries,
              a.zipfiles,
              a.datas,
              name='LightShowApp',
              debug=False,
              strip=False,
              upx=True,
              console=True )
    

    Look at 'pathex' and 'hiddenimports' above. Those are the only changes from default generated. Build exe with:

    pyinstaller LightShowApp.spec -F

    I ran that outside of venv or pip-win - whateverTF that crap is for!

提交回复
热议问题