将kivy文件转换为可执行文件

时间:2017-12-16 22:16:50

标签: python windows kivy exe

我尝试使用以下问题的答案,但它不适合我。 Kivy: compiling to a single executable 我做的第一个命令是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

然后我编辑spec文件,看起来像这样

# -*- 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 )

然后我运行以下命令python -m PyInstaller myapp.spec

但每当我尝试运行exe时,它会打开并立即关闭。我通过命令行运行它,没有给出任何错误。

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:-1)

似乎我并没有完全解决我已经链接的堆栈溢出问题的答案。一旦我做了它就开始工作了。

相关问题