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

时间:2017-09-22 07:18:53

标签: python python-3.x cx-freeze

click to see the error

click to see the error

我用cx_freeze构建后的错误apprerd。我的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")],
)

1 个答案:

答案 0 :(得分:0)

我前段时间遇到过类似的问题。这对我有用:

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'),
         ],
    },
}
相关问题