Exe File working on my machine but not working on other machine
hamzaumer2 opened this issue · 3 comments
hamzaumer2 commented
setup.py:
import sys
import os
from cx_Freeze import setup, Executable
site_packages_path = './env/Lib/site-packages'
# dll_paths = []
# with open('all_dlls.txt', 'r') as file:
# dll_paths = [line.strip() for line in file.readlines()]
# include_files = [(path, os.path.basename(path)) for path in dll_paths]
include_files = [
'logo.png',
'FullLogoColored.png',
(os.path.join(site_packages_path, 'PyQt5'), 'PyQt5'),
(os.path.join(site_packages_path, 'cx_Freeze'), 'cx_Freeze'),
('vcruntime140.dll', 'vcruntime140.dll'), # Include the DLL
('Qt5Core.dll', 'Qt5Core.dll'),
('Qt5Gui.dll', 'Qt5Gui.dll'),
('Qt5Widgets.dll', 'Qt5Widgets.dll'),
('libiconv.dll', 'libiconv.dll'),
]
# Define build options
build_exe_options = {
# "includes": ["PyQt5.QtCore", "PyQt5.QtGui", "PIL", "pyzbar", "qrcode", "cx_Freeze"],
"includes": ["sys","PyQt5.QtWidgets", "PyQt5.QtGui","PyQt5.QtCore","PIL", "pyzbar", "qrcode", "cx_Freeze","re","os"],
"include_files": include_files,
"replace_paths": [("*", "")],
# "silent" : False,
}
# Get the base directory
base = None
if sys.platform == "win32":
base = "Win32GUI" # If you want to hide the console, use "Win32GUI"
# Additional environment variables to be set for the frozen application
os.environ['PYTHONPATH'] = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'env', 'Lib', 'site-packages')
# Setup
setup(
name='Coder',
version='1.0',
description='Description',
options={
'build_exe': build_exe_options
},
executables=[Executable("main.py", base=base)]
)
Working fine on my device but if I run on another device I get this error:
Specifications:
Machine A is building --> Running Windows 11
Machine B is giving error --> Running Windows 11
Machine C is giving error --> Running Windows 10
Tried Building with:
Python 3.12
Python 3.11
Python 3.9
Python 3.8
Python 3.7
Same issue with all
marcelotduarte commented
The likely cause is that you are breaking automatic dependency detection when including vcr qt files, so use include_files to include only the .png files and also use the include_msvcr.
hamzaumer2 commented
hamzaumer2 commented
Update:
Restarted Device and now its working. Thanks alot for the help
im closing the issue