运行cx_Freeze生成的exe文件时导入错误

时间:2018-07-12 08:11:42

标签: python exe cx-freeze

我已经使用cx_Freeze模块创建了一个文件,该模块包含用于导入不同库的导入语句,但是当我运行exe文件时,它给我一个导入错误。

下面是setup.py和代码mainfile.py的前几行。

我已经尝试了stackoverflow上所有可用的解决方案,但仍然无法正常工作。

下面是setup.py

from cx_Freeze import setup, Executable
import os

base = None
executables = [Executable("completeFile.py", base=base)]

packages = ["idna", "os", "sys", "numpy", "matplotlib", "xml", "traceback", "xlwings", "io"]
options = {
    'build_exe': {
        'packages':packages,
        'include_files': ['parceExcelCleaned.py', 'pyplotter.py', 'mainplotter.py']
    },
}

os.environ['TCL_LIBRARY'] = r"filepath\tcl8.6"
os.environ['TK_LIBRARY'] = r"filepath\tk8.6"

setup(
    name = "Lateral Investigation Plot",
    options = options,
    version = "1.0",
    description = 'Testing how to create EXE files',
    executables = executables
)

下面是mainfile.py

import sys
import traceback
import pyplotter as pypltr
import parceExcelCleaned as parsxl
import webbrowser as wb

try :

    rem = sys.argv[1]

    timeLine = parsxl.parseRemarks(rem) 

    #    timeLine = parsxl.parseRemarks()

    res = pypltr.timeLinePlotter(timeLine)

    if res:
        wb.open_new_tab('svg_tooltip.svg')

0 个答案:

没有答案