我使用cx_Freeze模块将Python应用程序转换为Windows。你知道吗
我有一个简单的Python文件norm.py
:
print("Hi there !")
另一个文件makeup.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时,它什么也不做。我希望它打印"Hi there!"
我使用的是Python3.4,因为有些帖子说3.5在这个模块上有问题。你知道吗
您正在使用创建GUI应用程序
为了构建一个控制台应用程序,您应该删除它。你知道吗
如果您没有任何错误,可能是您必须在“print”(“Hi there!”)下面写“input()”。你知道吗
相关问题 更多 >
编程相关推荐