简体   繁体   English

如何使用cx_freeze在python中使用多个文件构建单个.exe文件

[英]How to build single .exe file with multiple files in python using cx_freeze

Using Python 3.5 and cx_freeze 5.0.1 使用Python 3.5和cx_freeze 5.0.1

**MY Folder Structure :**
Main_file.py, 
Log.py, 
ExcelOperations.Py, 
TestData.xlsx, 
Config.ini,  
PsExec.exe (For remote execution) 

I am trying to create single .exe file for Main_file.py which is imported with [Log.py,ExcelOperations.Py and OS, subprocess,configparser are imported in Main_file.py file] 我正在尝试为Main_file.py创建单个.exe文件,该文件是使用[Log.py,ExcelOperations.Py和OS,子进程,configparser导入Main_file.py文件]导入的。

My Setup.py file 我的Setup.py文件

import sys
from cx_Freeze import setup, Executable
build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]}
base = None
setup( name = "guifoo",
    version = "0.1",
    description = "My GUI application!",
    options = {"build_exe": build_exe_options},
    executables = [Executable("Main_file.py", base=base)])

# After creating build with above setup file my Main_file.exe file is not working as expected [It just launches and closes the cmd in a mili sec] #使用上面的安装文件创建构建后,我的Main_file.exe文件无法按预期工作[它只是在mili sec中启动和关闭cmd]

Please let me know what am I doing wrong in this? 请让我知道我在这做错了什么?

It looks like cx_freeze isn't collecting all of the required modules for the xlwt package. 看起来cx_freeze没有为xlwt包收集所有必需的模块。 Try editing your build_exe_options variable to include the xlwt package 尝试编辑build_exe_options变量以包含xlwt包

build_exe_options = {"packages": ["os", "xlwt"], "excludes": ["tkinter"]}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM