Reputation: 410
I am using Python 3.5.4 and trying to make 'exe' with Cx_Freeze with following setup:
import cx_Freeze
import sys
import PyQt5
import matplotlib
import numpy
import cv2
base = None
if sys.platform == 'win32':
base = "Win32GUI"
executables = [cx_Freeze.Executable("Halcon_Reborn_Python_GUI.py", base=base, icon="tdic.ico")]
cx_Freeze.setup(
name = "Halcon Reborn",
options = {"build_exe": {"packages":["PyQt5","matplotlib","numpy","OpenCV"], "include_files":["tdic.ico"]}},
version = "0.01",
description = "Halcon Reborn Python GUI with ROI",
executables = executables
)
But when I execute the setup.py
I received following error
Following are the imports in my GUI python file:
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QMenu, QVBoxLayout, QSizePolicy, QMessageBox
from PyQt5.QtWidgets import QFileDialog, QLabel, QWidget, QPushButton,QDialog,QDialogButtonBox
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import Qt
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
from numpy.lib.stride_tricks import as_strided as ast
from itertools import product
import matplotlib.pyplot as plt
import timeit
import numpy as np
import random
import cv2
import ctypes
Upvotes: 2
Views: 3980
Reputation: 410
Here is the code which solved my problem :
import cx_Freeze
import sys
import matplotlib
import numpy
import cv2
import os
import ctypes
import timeit
import tkinter
base = None
if sys.platform == 'win32':
base = "Win32GUI"
executables = [cx_Freeze.Executable("Halcon_Reborn.py", base=base, icon="tdic1.ico")]
os.environ['TCL_LIBRARY'] = r'C:\Users\danial khan\AppData\Local\Programs\Python\Python35\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = r'C:\Users\danial khan\AppData\Local\Programs\Python\Python35\tcl\tk8.6'
cx_Freeze.setup(
name = "Halcon Reborn",
options = {"build_exe": {"packages":["tkinter","PyQt5.QtCore","PyQt5.QtGui", "PyQt5.QtWidgets","ctypes","timeit","matplotlib","numpy","cv2"], "include_files":[r"C:\Users\danial khan\AppData\Local\Programs\Python\Python35\Lib\site-packages\PyQt5\plugins\platforms\qwindows.dll",r"C:\Users\danial khan\AppData\Local\Programs\Python\Python35\DLLs\tcl86t.dll",r"C:\Users\danial khan\AppData\Local\Programs\Python\Python35\DLLs\tk86t.dll","tdic1.ico"]}},
version = "0.01",
author='Muhammad Danial Khan',
description = "Halcon Reborn Python GUI with ROI",
executables = executables
)
Upvotes: 2