冻结kivy之后,应用程序运行,但没有窗口

时间:2019-03-05 04:04:27

标签: python-3.x kivy

我的应用程序从代码执行时运行良好,但是当我使用PyInstaller冻结应用程序时,它们只是没有打开任何窗口。

这是代码https://gist.github.com/osnipezzini/a226b806a8ad5aa9000a30b723844db2

的一部分

使用debug = true,我可以看到此日志,并且python正在运行主文件,但没有窗口启动。

[7412] PyInstaller Bootloader 3.x
[7412] LOADER: executable is C:\Users\osnip\PycharmProjects\TelaBicos\dist\main\main.exe
[7412] LOADER: homepath is C:\Users\osnip\PycharmProjects\TelaBicos\dist\main
[7412] LOADER: _MEIPASS2 is NULL
[7412] LOADER: archivename is C:\Users\osnip\PycharmProjects\TelaBicos\dist\main\main.exe
[7412] LOADER: No need to extract files to run; setting extractionpath to homepath
[7412] LOADER: SetDllDirectory(C:\Users\osnip\PycharmProjects\TelaBicos\dist\main)
[7412] LOADER: Already in the child - running user's code.
[7412] LOADER: Python library: C:\Users\osnip\PycharmProjects\TelaBicos\dist\main\python36.dll
[7412] LOADER: Loaded functions from Python library.
[7412] LOADER: Manipulating environment (sys.path, sys.prefix)
[7412] LOADER: sys.prefix is C:\Users\osnip\PycharmProjects\TelaBicos\dist\main
[7412] LOADER: Pre-init sys.path is C:\Users\osnip\PycharmProjects\TelaBicos\dist\main\base_library.zip;C:\Users\osnip\PycharmProjects\TelaBicos\dist\main
[7412] LOADER: Setting runtime options
[7412] LOADER: Initializing python
[7412] LOADER: Overriding Python's sys.path
[7412] LOADER: Post-init sys.path is C:\Users\osnip\PycharmProjects\TelaBicos\dist\main\base_library.zip;C:\Users\osnip\PycharmProjects\TelaBicos\dist\main
[7412] LOADER: Setting sys.argv
[7412] LOADER: setting sys._MEIPASS
[7412] LOADER: importing modules from CArchive
[7412] LOADER: extracted struct
[7412] LOADER: callfunction returned...
[7412] LOADER: extracted pyimod01_os_path
[7412] LOADER: callfunction returned...
[7412] LOADER: extracted pyimod02_archive
[7412] LOADER: callfunction returned...
[7412] LOADER: extracted pyimod03_importers
[7412] LOADER: callfunction returned...
[7412] LOADER: Installing PYZ archive with Python modules.
[7412] LOADER: PYZ archive: PYZ-00.pyz
[7412] LOADER: Running pyiboot01_bootstrap.py
[7412] LOADER: Running pyi_rth_pkgres.py
[7412] LOADER: Running pyi_rth_win32comgenpy.py
[7412] LOADER: Running pyi_rth_multiprocessing.py
[7412] LOADER: Running pyi_rth_kivy.py
[7412] LOADER: Running pyi_rth_gstreamer.py
[7412] LOADER: Running main.py
[7412] LOADER: OK.
[7412] LOADER: Cleaning up Python interpreter.

1 个答案:

答案 0 :(得分:0)

您的代码包含一些print()函数,当您尝试使用pyinstaller冻结应用程序时,您通过了windowed属性,该属性删除了控制台选项。

主要问题

您的程序尝试将某些内容打印到控制台上,但是没有可用的控制台,因此它将关闭。

在冻结过程中删除那些print()功能或删除windowed属性 main.py file contain print()