【发布时间】:2020-04-10 23:12:41
【问题描述】:
你好
我尝试学习 Python ... 我自己做了一个小软件,用于从 XLSX 读取数据,当我以“正常方式 / python 方式”(在崇高文本中 ctrl + B)启动时,一切都运行良好。 ... 但 ... 当我用“cx.freeze”编译它以获取我的“.exe”并启动我的.exe时,我得到这个错误窗口:
(https://i.stack.imgur.com/E2GVw.png)
我尝试了图书馆,问我更新了我的所有图书馆,但什么也没有
这里是我的代码的开头和结尾,以及 PIP 安装的库:
# c-*- coding: utf-8 -*-
# Bibliotheques
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import openpyxl
import xlrd
import mpl_toolkits
import sys
import os
from tkinter import *
from tkinter import messagebox
from tkinter.filedialog import * # askopenfilename
from functools import partial
from PIL import Image, ImageTk
class MyApp(Tk): # --- Class.N°1 --- #
def __init__(self):
Tk.__init__(self)
if __name__ == '__main__':
MyApp()
这里是我使用的 CX.freeze scrypt:
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')
base = "Win32GUI" #pour appli graphique ss windows
#base = "console" #pour appli console
options = {
'build_exe': {
'include_files':[
os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'),
os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll'),
],
},
}
# On appelle la fonction setup
setup(name = "GraphEditor",
options = options,
version = "V1.1.2",
author = "Scorn",
description = "Reading and editing trends from 2D table",
executables = [Executable("GraphEditor.py",base=base, icon="xln.ico")]
)
所以我的问题是:为什么会出现此错误,以及如何解决?
谢谢你的时间和你的回答:)
【问题讨论】:
标签: python pandas matplotlib tkinter cx-freeze