cx_Freeze EXE应用程序在其他计算机上不起作用

问题描述 投票:0回答:1

我想将python脚本更改为可执行文件。

编译正确进行,并且可执行文件在我的计算机上正常工作。

问题是,当我将exe.win32-3.8目录导出到另一台计算机时,该可执行文件不起作用。执行窗口打开并立即关闭。 IE窗口不会打开。

这是我的setup.py:

from cx_Freeze import setup, Executable
# On appelle la fonction setup
setup(
   name = "CampaignRecovery",
   version = "0.1",
   description = "Ce programme recupère les campagnes depuis Opoci",
   executables = [Executable("CampaignRecovery.py")],
)

还有我的源代码:

from selenium import webdriver
from selenium.webdriver.ie.options import Options

ieOptions = Options()
ieOptions.ignore_protected_mode_settings = True

browser = webdriver.Ie(options=ieOptions)

您能帮我吗?

问候

python cx-freeze
1个回答
0
投票
import cx_Freeze import sys import os PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__)) os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6') os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6') print(os.environ['TCL_LIBRARY'],os.environ['TK_LIBRARY']) base = None if sys.platform == 'win32': base = 'Win32GUI' syspath = r"C:\Python\DLLs" buildOptions = dict( packages=["tkinter","pandas","numpy"], excludes=[], include_files=[('tcl86t.dll', os.path.join('lib', 'tcl86t.dll')),('tk86t.dll', os.path.join('lib', 'tk86t.dll'))] ) executables = [cx_Freeze.Executable("[YOUR APP].py", base=base, icon="hitek.ico")] cx_Freeze.setup( name = "YOUR APP", options = dict(build_exe=buildOptions), version = "0.02", description = "YOUR APP", executables = executables )
© www.soinside.com 2019 - 2024. All rights reserved.