这是我正在使用的安装文件
import cx_Freeze
import sys
import os
base = None
if sys.platform == 'win32':
base = "Win32GUI"
os.environ['TCL_LIBRARY'] = r"C:\Users\osama shakeel\AppData\Local\Programs\Python\Python37-32\tcl\tcl8.6"
os.environ['TK_LIBRARY'] = r"C:\Users\osama shakeel\AppData\Local\Programs\Python\Python37-32\tcl\tk8.6"
os.environ['TK_LIBRARY'] = r"C:\Users\osama shakeel\AppData\Local\Programs\Python\Python37-32\tcl\treectrl2.4.1"
executables = [cx_Freeze.Executable("alkhidmat.py", base=base, icon=r"C:\Users\osama shakeel\PycharmProjects\alkhidmat-project\icon.ico")]
cx_Freeze.setup(
name = "Alkhidmat Management System",
options = {"build_exe": {"packages":["tkinter"], "include_files":[r"C:\Users\osama shakeel\PycharmProjects\alkhidmat-project\icon.ico",'tcl86t.dll','tk86t.dll', 'icons2']}},
version = "0.01",
description = "Tkinter Application",
executables = executables
)
这些是我正在使用的库。
import tkinter as tk
from tkinter import ttk
from tkcalendar import Calendar, DateEntry
from csv import DictWriter, DictReader
import os
import tkinter
from TkTreectrl import *
import pandas as pd
这是我在安装应用程序后遇到的错误 我下载的外部软件包是TkTreectrl,程序的另一功能是在存在my(alkhidmat.py)文件的当前目录中自动创建csv文件
cx_Freeze: Python error in main script
Traceback (most recent call last):
File "C:\Users\osama
shakeel AppData\Local\Programs\Python Python37-32\lib \site
-packages\cx_Freeze\initscripts _startup_.py", line 40, in run
module.runo
File "C:\Users\osama
shakeel AppData\Local\Programs\Python Python37-32\lib\site
-packages\cx_Freeze\initscripts\Console.py", line 37, in run
exec(code, [name__ main__'})
File "alkhidmat.py", line 1, in <module>
ModuleNotFoundError: No module named 'tkinter
ок
1
答案 0 :(得分:0)
我可以给您一个很好的建议,请不要使用CX-FREEZE,请使用 auto-py-to-exe 。使用此模块,您将可以向您的应用添加个人图标,还可以通过一种非常简单的方式添加其他文件。以下是从您的cmd here
进行安装的链接。答案 1 :(得分:-1)
尝试查看您的./lib文件夹(在bulid文件夹中),然后将“ Tkinter”文件夹重命名为“ tkinter”