【发布时间】:2015-12-23 15:28:01
【问题描述】:
我是 cx_Freeze 的新手。 我开始在一个大型 python 应用程序中使用它。该应用程序正在使用 PySide 并使用多处理。在应用程序启动时,每次线程启动时,我都会看到一个 cmd 窗口很快闪烁(只是快速打开和关闭......没有时间阅读任何内容)。 现在我尝试了一个非常简单的应用程序。像这样:
import os
import sys
import multiprocessing
from PySide import QtGui
from PySide import QtCore
from PySide import QtNetwork
if __name__ == '__main__':
# multiprocessing support
multiprocessing.freeze_support()
# init application
app = QtGui.QApplication.instance()
if not app:
app = QtGui.QApplication(sys.argv)
QtGui.QApplication.setQuitOnLastWindowClosed(False)
# check systemtray
if not QtGui.QSystemTrayIcon.isSystemTrayAvailable():
QtGui.QMessageBox.critical(None, "Systray", "I couldn't detect any system tray on this system.")
sys.exit(1) # quick kill
wid = QtGui.QWidget()
wid.resize(250, 150)
wid.setWindowTitle('Simple')
wid.show()
sys.exit(app.exec_())
但这仍然在启动时显示和闪烁一个窗口。 这是我使用的安装文件:
from cx_Freeze import setup, Executable
# dependencies
build_exe_options = {
"packages": [#"os", "sys", "glob", "re", "atexit",
"PySide.QtCore", "PySide.QtGui", "PySide.QtXml", 'PySide.QtXml',
'xml', 'P4', 'MYRefs_module', 'MYUtils_module', 'logging',
'multiprocessing'],
# "include_files": mfiles, # this isn't necessary after all
"excludes": ["Tkinter", "Tkconstants", "tcl"],
"build_exe": "build",
"icon": "img/icon.ico",
"include_msvcr":True
}
executable = [
Executable("main.pyw",
base="Win32GUI",
initScript = None,
targetName="Example.exe",
targetDir="build",
copyDependentFiles=True,
)
]
setup(
name="Example",
version="0.1",
description="Example", # Using the word "test" makes the exe to invoke the UAC in win7. WTH?
author="Me",
options={"build_exe": build_exe_options},
executables=executable,
requires=['PySide', 'cx_Freeze', 'P4', 'xml']
)
可能是我做错了什么?多处理支持问题吗?任何提示表示赞赏。 顺便说一句,我正在使用 python 2.7.3x64 和 cx_Freeze 4.3.4、PySide 1.2.2 ...
【问题讨论】:
标签: python pyside cx-freeze python-multiprocessing