简体   繁体   中英

cx_freeze error after converting in to exe file tkinter

This is setup file which I am using

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
    )

And these are the libraries which I am using.

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

And this is error which I am getting after my installation of app External package which I downloaded is TkTreectrl, and another function of program is automatically creates csv file in the current directory where my(alkhidmat.py) file is present

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

I can give you a great advice,D'ONT USE CX-FREEZE, use auto-py-to-exe . using this module, you will be ableto add an personal icon to your app, also add additional files in a very easy way.And here is the link to install it from you cmd here

尝试查看您的 ./lib 文件夹(在您的 bulid 文件夹中)并将“Tkinter”文件夹重命名为“tkinter”

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM