我已经用Python编写了一个TCP客户端程序,并希望使用Cx_Freeze从中创建一个可执行文件。
我使用了如下所示的setup.py文件:
import sys
from cx_Freeze import setup, Executable
if sys.argv[1] == 'bdist_msi':
sys.argv += ['--initial-target-dir', 'C:\TCP CLIENT\\']
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os"], "excludes": ["tkinter"], 'init_script':'Console'}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup( name = "TCP Client",
version = "0.1",
description = "My GUI application!",
options = {"build_exe": build_exe_options},
executables = [Executable("MBMD TCP CLIENT.py", base=base)])
我想在exe运行时在控制台上打印。
为此,我使用过: 的raw_input() 但它会引发错误:
我的目标是在控制台上打印一些。
请帮助我,以便在程序运行时我可以在控制台上打印。