cxfreeze小部件与tkinter xgboost没有显示但没有错误

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

我的节目是在anaconda spyder工作。然而,在冻结之后,使用tkinter模块的所有小部件都工作,除了带有xgboost和pandas的小部件。没有错误显示,构建工作,但按钮不工作,并没有显示小部件。

我已尝试在我的setup.py文件中导入并包含xgboost,但所有其他小部件都使用tkinter完全不起作用。虽然没有错误。谁有经验或解决过这个问题?

这是最接近的工作。这是我的setup.py,当其他小部件与tkinter一起使用但不与xgboost和pandas一起使用时。

from cx_Freeze import setup, Executable
import sys
import os

includes = []
include_files = [r"C:/Users/USER/Anaconda3/DLLs/tcl86t.dll",
         r"C:/Users/USER/Anaconda3/DLLs/tk86t.dll",
         r"C:/Users/USER/SAMPLE/xgboost_USE.model",
         r"C:/Users/USER/SAMPLE/P1.ico"]
os.environ['TCL_LIBRARY'] = "C:/Users/USER/Anaconda3/tcl/tcl8.6"
os.environ['TK_LIBRARY'] = "C:/Users/USER/Anaconda3/tcl/tk8.6"
base = 'Win32GUI' if sys.platform == 'win32' else None


setup(name=application_title, version='1.0', description='SAMPLE',
      options={"build_exe": {"includes": includes, "include_files":                 
      include_files}},executables=
      [Executable(r'C:/Users/USER/SAMPLE/sample.py', base=base)])

请帮忙。

python tkinter widget cx-freeze xgboost
1个回答
0
投票

我对xgboost没有任何经验,但我知道当你cx冻结pandas时你需要明确包含numpy。我将分享一个我有pandas的安装文件(以及其他一些你可以删除的东西,如我认为的boto)

import sys
import cx_Freeze
import os.path
import scipy

base = None

if sys.platform == 'win32':
    base = "Win32GUI"

#This part may depend on where your installation is
#This part is essential to copy the tkinter DLL files over
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')
os.environ['REQUESTS_CA_BUNDLE'] = r'C:\ProgramData\Anaconda3\Lib\site-packages\botocore\vendored\requests\cacert.pem'


executables = [cx_Freeze.Executable("test.py", base=base)]
addtional_mods = ['numpy.core._methods', 'numpy.lib.format']

packages = ["idna", "numpy", "boto3", 'boto3.s3.transfer', 'boto3.s3.inject', 'multiprocessing', "xlwt", 'numpy.core._methods', 'pandas']
options = {
    'build_exe': {

        'include_files':[
            os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'),
            os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll'),
            os.path.dirname(scipy.__file__),
            r'C:\ProgramData\Anaconda3\Lib\site-packages\botocore\vendored\requests\cacert.pem',
            r'C:\ProgramData\Anaconda3\Lib\site-packages\botocore',

         ],
        'includes': addtional_mods,
        'packages':packages,
    },

}

cx_Freeze.setup(
    name = "Test",
    options = options,
    version = "1.0.0.0",
    description = 'Test',
    executables = executables
)
© www.soinside.com 2019 - 2024. All rights reserved.