Py2exe Missing Modules and AttributeError

I’m trying to build a executable with the py2exe package.

My code is :

import tkinter
import customtkinter

customtkinter.set_appearance_mode(“System”) # Modes: system (default), light, dark
customtkinter.set_default_color_theme(“blue”) # Themes: blue (default), dark-blue, green

app = customtkinter.CTk() # create CTk window like you do with the Tk window

def button_function():
print(“button pressed”)

Use CTkButton instead of tkinter Button

button = customtkinter.CTkButton(master=app, text=“CTkButton”, command=button_function), rely=0.5, anchor=tkinter.CENTER)


and my setupfile is
from distutils.core import setup
#from setuptools import setup
import py2exe
import customtkinter
import tkinter

options = {‘py2exe’: {
‘compressed’: True,
‘includes’: ‘customtkinter’
windows = [‘’]

By building it with the command
→ build_exe

severall issuses occur. First lots of modules are missing and second the AttributeError: ‘Namespace’ object has no attribute ‘libname’ occurs.