Programda kendi oluşturduğum modülleri kullanıyorum (user, admin, gui, database, shift) programı cx_freeze ile exe’e çevirmeye çalışınca
ImportError: No module named ‘user’
hatası veriyor.
setup.py:
import sys
from cx_Freeze import setup, Executable
build_exe_options = {
"packages": ["user", "admin", "database", "gui", "shift", "reportlab", "tkcalendar", "yaml", "mysql.connector"],
"include_files": ["icon.ico"]
}
base = None
if sys.platform == "win32":
base = "Win32GUI"
exe = Executable(
script="main.py",
base=base
)
setup(
name="Personel Vardiya",
version="1.0",
description="",
options={"build_exe": build_exe_options},
executables=[exe]
)
hata:
running build
running build_exe
Traceback (most recent call last):
File "C:\AAA\Yazılım\Python\projects\School_Project\setup.py", line 18, in <module>
setup(
File "C:\Users\Niuren_\AppData\Roaming\Python\Python311\site-packages\cx_Freeze\__init__.py", line 61, in setup
setuptools.setup(**attrs)
File "C:\Program Files\Python311\Lib\site-packages\setuptools\__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
return run_commands(dist)
^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
dist.run_commands()
File "C:\Program Files\Python311\Lib\site-packages\setuptools\_distutils\dist.py", line 968, in run_commands
self.run_command(cmd)
File "C:\Program Files\Python311\Lib\site-packages\setuptools\dist.py", line 1217, in run_command
super().run_command(command)
File "C:\Program Files\Python311\Lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
cmd_obj.run()
File "C:\Program Files\Python311\Lib\site-packages\setuptools\_distutils\command\build.py", line 132, in run
self.run_command(cmd_name)
File "C:\Program Files\Python311\Lib\site-packages\setuptools\_distutils\cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "C:\Program Files\Python311\Lib\site-packages\setuptools\dist.py", line 1217, in run_command
super().run_command(command)
File "C:\Program Files\Python311\Lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
cmd_obj.run()
File "C:\Users\Niuren_\AppData\Roaming\Python\Python311\site-packages\cx_Freeze\command\build_exe.py", line 254, in run
freezer: Freezer = Freezer(
^^^^^^^^
File "C:\Users\Niuren_\AppData\Roaming\Python\Python311\site-packages\cx_Freeze\freezer.py", line 727, in __init__
Freezer.__init__(self, *args, **kwargs)
File "C:\Users\Niuren_\AppData\Roaming\Python\Python311\site-packages\cx_Freeze\freezer.py", line 118, in __init__
self.finder: ModuleFinder = self._get_module_finder()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Niuren_\AppData\Roaming\Python\Python311\site-packages\cx_Freeze\freezer.py", line 370, in _get_module_finder
finder.include_package(name)
File "C:\Users\Niuren_\AppData\Roaming\Python\Python311\site-packages\cx_Freeze\finder.py", line 762, in include_package
module = self._import_module(name, deferred_imports)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Niuren_\AppData\Roaming\Python\Python311\site-packages\cx_Freeze\finder.py", line 320, in _import_module
raise ImportError(f"No module named {name!r}")
ImportError: No module named 'user'
build_exe_options
içinden user çıkarınca hata vermiyor ve exe’e çeviriyor.
Bir türlü çözemedim yardımcı olursanız çok sevinirim şimdiden teşekkürler.
pyinstaller hidden-import kullanarak da yapmayı denedim o zaman exe çeviriyor ama tam çalışmıyor.