我正在尝试制作一个Python应用程序,该应用程序具有以html / javascript制成的GUI。我正在 Windows 7 上运行此代码。作为测试用例,我正在使用以下代码:
gui.py:
import webview
webview.create_window("Test", "login.html")
while True:
pass
setup.py:
import sys, os
from cx_Freeze import setup, Executable
__version__ = "0.0.1"
include_files = ['login.html']
excludes = []
packages = ['webview']
setup(
name = "Test",
description='App Description',
version=__version__,
options = {"build_exe": {
'packages': packages,
'include_files': include_files,
'includes' : 'atexit',
'excludes': excludes,
'include_msvcr': True,
}},
executables = [Executable("gui.py",base="Win32GUI")]
)
如果您感到好奇,请访问 login.htm:
<html>
<h1>Welcome!</h1>
</html>
我在正确的目录中运行了以下命令: python setup.py build
它确实输出了一个文件: gui.exe
但是,运行该文件时,无论是具有管理员身份还是没有管理员身份,它只会显示“ gui.exe已停止工作”,并且没有GUI。
我尝试了大约两个小时而不是cx_Freeze来完成这项工作,但是我似乎无法找到完成方法。