Class 将.py编译为包含it类的.exe
我有4.py文件。下面是运行程序所需的文件列表。他们中的任何一个失踪都将使程序无法运行 我的代码如何工作:Class 将.py编译为包含it类的.exe,class,python-3.x,py2exe,python-import,cx-freeze,Class,Python 3.x,Py2exe,Python Import,Cx Freeze,我有4.py文件。下面是运行程序所需的文件列表。他们中的任何一个失踪都将使程序无法运行 我的代码如何工作: )GUIss.py导入演示器.py )explorator.py导入filereader.py和process.py )要运行该程序,只需单击GUIss.py 我的cx冻结代码如下: 运行编译后的文件时,会收到一条错误消息: 然后我尝试在setup.py(cx冻结文件)中写入 尽管多次尝试,但没有运气,一直都是相同的信息 附言 我的python源代码可以从 我确实研究了数小时,修改了无
我确实研究了数小时,修改了无数次,但没有运气。打开后立即关闭通常意味着在您可以阅读它之前,错误就会消失。如果从命令行运行exe,是否会看到错误消息?@ThomasK error-ImportError:没有名为'process'的模块实际上是GUIss.py依赖的另一个.py文件,因此无法成功运行。请尝试将
'includes':['process']
添加到生成exe选项中,“我确实添加了这个,但现在它显示没有名为‘tkinter’的模块,我也尝试添加了这个模块,但没有成功。”。我成功地添加了模块xlrd,因为它也要求这样做。我现在更新了我的代码。如果有什么东西需要它,它肯定不应该在excludes中-我很困惑,因为你在setup.py文件的excludes中显示了它。它在Python 3中拼写为tkinter
,全小写。你能显示冻结后的输出吗?它会很长,所以把它放在一个垃圾桶里。
from cx_Freeze import setup,Executable
import os
includefiles = ['filereader.py','demonstrator.py','logo.gif','thebrighterchoice.gif']
#bin_includes= ['process.py','demonstrator.py','filereader.py'] ..... 'bin_includes':bin_includesincludes = ['process']
includes = ['process','tkinter']
excludes = ['tkinter']
packages = ['os','xlrd']
setup(
name = "Process",
version = "0.1",
description = "description",
author = "Raitis Kupce",
options = {'build_exe' :{'excludes': excludes,'includes':includes,'packages':packages,'include_files':includefiles}},
executables = [Executable("GUIss.py")]
)
excludes = ['tkinter']
Then includes = ['tkinter']
Afterwards packages = ['tkinter']