I tried using the following questions answer but it was not working for me. Kivy: compiling to a single executable
The first command I do is pyinstaller --onefile -y --clean --windowed --name launcher --exclude-module _tkinter --exclude-module Tkinter --exclude-module enchant --exclude-module twisted C:/Users/Karl/Documents/aaaSpaceCRAFT/launcher/main.py
Then I edit the spec file so it looks like so
# -*- mode: python -*-
from kivy.deps import sdl2, glew
block_cipher = None
a = Analysis(['C:/Users/Karl/Documents/aaaSpaceCRAFT/launcher/main.py'],
pathex=['C:\\Users\\Karl\\Documents\\aaaSpaceCRAFT\\launcher'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=['_tkinter', 'Tkinter', 'enchant', 'twisted'],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
a.datas += [('launcher.kv', 'C:/Users/Karl/Documents/aaaSpaceCRAFT/launcher/launcher.kv', 'DATA')]
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='launcher',
debug=False,
strip=False,
upx=True,
runtime_tmpdir=None,
console=False )
And then I run the following command python -m PyInstaller myapp.spec
But whenever I try to run the exe it opens and immediately closes. I have run it through command line and no errors are given.
Any help would be greatly appreciated.