[英]Error after converting tkinter program to exe using cx_Freeze and running the exe file
[英]cx_freeze error after converting in to exe file tkinter
這是我正在使用的安裝文件
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,程序的另一個功能是在我的(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
我可以給你一個很好的建議,不要使用 CX-FREEZE,使用auto-py-to-exe 。 使用此模塊,你會ableto的個人圖標很容易way.And這里添加到您的應用程序,還可以添加其他文件是安裝它從你在cmd的鏈接在這里
嘗試查看您的 ./lib 文件夾(在您的 bulid 文件夾中)並將“Tkinter”文件夾重命名為“tkinter”
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.