Pyinstaller “Failed to execute script pyi_rth_pkgres” and missing packages

后端 未结 8 513
旧时难觅i
旧时难觅i 2020-11-29 03:54

This is my first time posting a question here as most of my questions have already been answered by someone else! I am working on a GUI application in python and am attempt

相关标签:
8条回答
  • 2020-11-29 04:50

    I had the same problem. Was solved by reinstalling the pyinstaller with the developer's branch version, following the directions in: https://github.com/pyinstaller/pyinstaller/issues/2137

    The steps are:

    • Remove PyInstaller pip uninstall pyinstaller.
    • Download the zip from github.
    • Unzip file.
    • Make sure you are in the directory with "setup.py" and run: python setup.py install
    0 讨论(0)
  • 2020-11-29 04:51

    To iterate further on the best hidden answer from elton fernando.

    # -*- mode: python ; coding: utf-8 -*-
    from kivy_deps import sdl2, glew
    import pkg_resources.py2_warn # before you add it to hiddenimports, import it here.
    import dependency_injector.errors
    import six
    block_cipher = None
    
    
    a = Analysis(['...'],
                 pathex=['..'],
                 binaries=[],
                 datas=[],
                 hiddenimports=['pkg_resources.py2_warn', 'dependency_injector.errors', 'six'], # This is the line you need
                 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,
              [],
              exclude_binaries=True,
              name='...',
              debug=False,
              bootloader_ignore_signals=False,
              strip=False,
              upx=True,
              console=True )
    coll = COLLECT(exe,
                    Tree('./'),
                   a.binaries,
                   a.zipfiles,
                   a.datas,
                   *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
                   strip=False,
                   upx=True,
                   upx_exclude=[],
                   name='...')
    

    Whenever you encounter an import error, just import them at the top and add them as a string to hiddenimports in the array.

    0 讨论(0)
提交回复
热议问题