Python to EXE构建一个无所事事的文件

Python to EXE构建一个无所事事的文件,python,python-3.x,cx-freeze,Python,Python 3.x,Cx Freeze,我使用模块将Python应用程序转换为Windows 我有一个简单的Python文件norm.py: print("Hi there !") 另一个文件compose.py将上述文件转换为exe: import sys from cx_Freeze import setup, Executable include_files = ['autorun.inf'] os_base = None if sys.platform == "win32": os_base = "Win32GU

我使用模块将Python应用程序转换为Windows

我有一个简单的Python文件
norm.py

print("Hi there !")
另一个文件
compose.py
将上述文件转换为exe:

import sys
from cx_Freeze import setup, Executable

include_files = ['autorun.inf']
os_base = None

if sys.platform == "win32":
    os_base = "Win32GUI"

setup(name="puzzle",
        version="0.1",
        description="Very cool puzzle",
        options={'build_exe':{'include_files':include_files}},
        executables=[Executable("norm.py", base=os_base)])
我在同一个文件夹中还有
autorun.inf
。 当我通过运行命令生成此文件时,也不会出现错误:

python makeup.py build
它创建了一个
build
文件夹,里面有
norm.exe
。当我通过终端运行这个exe时,它什么都不做。我希望它打印
“你好!”


我使用的是Python3.4,正如一些帖子所说,3.5在这个模块上有问题。

您正在使用

if sys.platform == "win32":
    os_base = "Win32GUI"

为了构建控制台应用程序,您应该删除它。

如果没有任何错误,可能是您必须在“print”(“Hi there!”)的下面写“input()”


那么,我应该将OsBASE的值设置为什么?@ TilakMadichetti:它应该是没有的,Win 32 GUI基础隐藏控制台。请考虑解释解决方案;为什么它会起作用。
print ("Hi there !")
input()