Mri*_*lla 30 python wxpython cx-freeze
我正在使用wxPython开发一个Python应用程序并使用cxFreeze将其冻结.除了下面这一点之外,一切似乎都很顺利:
当我运行cxFreeze创建的可执行文件时,会弹出一个空白控制台窗口.我不想表现出来.有什么方法可以隐藏它吗?
它似乎没有在cxFreeze网站上记录,并且谷歌搜索没有与Py2Exe的一些类似的类型问题分开.
谢谢.
Mri*_*lla 20
这在某种程度上起作用,但它有问题.我的程序在控制台模式和GUI模式下运行.使用--console参数从控制台运行时,它以控制台模式运行.当我按照下面的步骤,这不再工作,我的程序只是一个GUI应用程序.
以下源代码来自于中的示例文件\Python\Lib\site-packages\cx_Freeze\samples\PyQt4\setup.py.当天的课程.阅读自述文件.
# A simple setup script to create an executable using PyQt4. This also
# demonstrates the method for creating a Windows executable that does not have
# an associated console.
#
# PyQt4app.py is a very simple type of PyQt4 application
#
# Run the build process by running the command 'python setup.py build'
#
# If everything works well you should find a subdirectory in the build
# subdirectory that contains the files needed to run the application
import sys
from cx_Freeze import setup, Executable
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup(
name = "simple_PyQt4",
version = "0.1",
description = "Sample cx_Freeze PyQt4 script",
executables = [Executable("PyQt4app.py", base = base)])
Run Code Online (Sandbox Code Playgroud)
小智 19
对于Windows:
您必须使用这样的行(根据需要使用文件夹和名称)
C:/Python/Scripts/cxfreeze C:/Python/Code/yourprogram.py --base-name=Win32GUI --target-dir C:/Python/Dist
Run Code Online (Sandbox Code Playgroud)
通过添加--base-name=Win32GUI选项,控制台窗口将不会出现.
| 归档时间: |
|
| 查看次数: |
17071 次 |
| 最近记录: |