0
我試圖凍結我的Python應用程序,並且在使用Cx_Freeze和Py2Exe時都遇到了同樣的問題。一旦我構建/凍結了代碼,我就啓動了可執行文件,並迅速在屏幕上閃爍大約6個控制檯(連續快速打開和關閉),直到我的GUI窗口(使用PyQt5創建)打開。一旦GUI窗口打開時,一切似乎都很正常操作。應用程序在打開之前快速打開並關閉多個控制檯(PyQt5,Cx_Freeze和Py2Exe)
注:DLL文件 似乎有大約DLL文件一個常見的錯誤,我已經包含了一個名爲與qwindows.dll文件夾的平臺,還有libEGL.dll直接在同一個文件文件夾爲可執行文件。我不相信這是相關但因爲我能真正看到我最初的Widget。
這裏是我的Cx_Freeze setup.py文件:
import sys
from cx_Freeze import setup, Executable
base = 'Win32GUI'
executables = [
Executable('__main__.py', base=base)
]
# Dependencies are automatically detected, but it might need fine tuning.
buildOptions = {"packages": [], "excludes": []}
#serial, requests, idna
setup(name = "Test",
version = "0.1",
description = "Manufacturing Testing Software",
options = dict(build_exe = buildOptions),
executables = executables)
這裏是我的Py2Exe setup.py文件:
from setuptools import setup
import os
import py2exe
includes = ["sip",
"PyQt5",
"PyQt5.QtCore",
"PyQt5.QtGui",
"PyQt5.QtWidgets",
"PyQt5.QtWebKit",
"PyQt5.QtWebKitWidgets",
"PyQt5.QtWebKitWidgets",
"PyQt5.QtNetwork",
"PyQt5.QtPrintSupport"]
datafiles = [("platforms", [r"C:\Users\allan\AppData\Local\Continuum\Anaconda2\Library\plugins\platforms\qwindows.dll"]),
("", [r"c:\windows\syswow64\MSVCP100.dll",
r"c:\windows\syswow64\MSVCR100.dll",
r"C:\Python36-32\Lib\site-packages\PyQt5\Qt\bin\libEGL.dll"])]
setup(
name='Test',
version='1',
windows=['__main__.py'],
data_files = datafiles,
options={
"py2exe":{
"includes": includes,
}
}
)