简体   繁体   中英

After attempted compile, Python/Kivy application won't launch

I have created a program that I'm attempting to compile, but after the compiling has finished and I attempt to launch the application from the .exe inside the /dist/ directory, it creates a command prompt window, opens the application window for a brief moment, then closes.

I have followed the Kivy procedure in adding the proper imports, as well as adding the requisite directories into the COLLECT area of the spec. I attempted to add the pyinstaller hooks import to the top, as some had recommended on various pages, but to no avail.

The application launches normally during testing via the command "python main.py", so I'm quite befuddled as to why it doesn't launch after compiling.

The spec:

# -*- mode: python -*-
from kivy.deps import sdl2, glew

block_cipher = None


a = Analysis(['..\\main.py'],
             pathex=['C:\\python programs\\Escape Room Program\\compiled'],
             binaries=[],
             datas=[],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             **get_deps_all())
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          exclude_binaries=True,
          name='EskapAid',
          debug=False,
          strip=False,
          upx=True,
          console=True )
coll = COLLECT(exe, Tree('..\\compiled'),
               a.binaries,
               a.zipfiles,
               a.datas, 
               Tree('..\\img\\', 'img'),
               *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
               strip=False,
               upx=True,
               name='EskapAid')

I don't mind providing any additional information as necessary, including what other steps I may have taken, but at the moment, I'm pretty stumped as to why it's not launching correctly.

Try running the application from a console so that you can view the error messages associated with the failed launch; if you click the .exe to open it, the console will disappear as soon as the application closes, which makes it difficult to see these errors. Most likely, you will see that the application failed to launch because it is missing packages, which you can add to the .spec file under the hiddenimports list. Check out this post for a description of why this might be necessary.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM