将kivy文件转换为executab

2024-05-23 22:42:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我试着使用以下问题的答案,但它不适合我。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时,它就会打开并立即关闭。我已经通过命令行运行了它,没有给出任何错误。你知道吗

任何帮助都将不胜感激。你知道吗


Tags: name命令falsetkinterkarlblockusersexclude