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

问题描述 投票:1回答:1

我尝试使用以下问题答案,但它不适合我。 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时它会打开并立即关闭。我通过命令行运行它并没有给出错误。

任何帮助将不胜感激。

python windows kivy exe
1个回答
-1
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.