简体   繁体   English

cx_freeze,导入错误:DLL加载失败(tkinter)

[英]cx_freeze, import error: DLL load failed (tkinter)

click to see the error 点击查看错误

click to see the error 点击查看错误

that error apprerd after I builded with cx_freeze. 我使用cx_freeze构建后,该错误得到解决。 and my setup.py code is 我的setup.py代码是

import sys
from cx_Freeze import setup, Executable
import numpy.core._methods
import numpy.lib.format
import os


build_exe_options = dict(
    compressed = True,
    includes = ["os","operator", "requests", "konlpy", "bs4", "copy", "jpype","numpy","idna","lxml","datetime","pygame","os","PIL","wordcloud","matplotlib","tkinter"],
    include_files = []
)





os.environ['TCL_LIBRARY'] = r'C:\Users\airne\Anaconda3\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = r'C:\Users\airne\Anaconda3\tcl\tk8.6'

setup(
    name = "Search Key Word",
    version = "2.0",
    author = "airnew",
    description = "검색엔진 키워드 분석",
    options = {"build_exe": {"packages":["os","operator","requests","konlpy","bs4","copy","jpype","numpy","idna","lxml","datetime","pygame","os","PIL","wordcloud","matplotlib","tkinter"]}},
    executables = [Executable("SearchKeyWord.py",base = "Win32GUI")],
)

I've had similar problem some time ago. 我前段时间有过类似的问题。 That worked for me: 这对我有用:

import sys
from cx_Freeze import setup, Executable
import os.path


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')

options = {
    'build_exe': {
        'include_files':[
            os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'),
            os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll'),
         ],
    },
}

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

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