It uses pyinstaller under the hood but walks you through the process with a GUI and I find it makes tweaking some of pyinstaller’s more advanced settings and adding in dependency files easier.Īlso, I would suggest making sure any anti-virus software you may have running isn’t interfering with the executable or pyinstaller. I would consider trying auto-py-to-exe first. You will likely need to dive into their more advanced documentation sections for this. To get around that there is a config file that you can have pyinstaller generate and than edit it to pull in all the things it needs to make an executable. No errors generated until I run the executable (if it runs at all).
I have this issue whenever I use pandas for instance. To pyinstaller, there are often “hidden dependencies” in many python libraries that don’t get automatically pulled in when you run it. However, it can be troublesome when building from larger projects that utilize a lot of libraries outside the python standard library or non-python files (like images, config files, and data files). We picked this code on purpose, rather than a simple 10 line application, so that we could try emulating a real life situation.I’ll second here and say pyinstaller. Self.ax.plot(pd.to_numeric(df), pd.to_numeric(df), color ='tab:blue', picker=True, pickradius=5)
Types = Ĭsv_file_path = askopenfilename(initialdir = ".", title = "Open File", filetypes=types) aph = FigureCanvasTkAgg(self.fig, self.canvas) Self.table = Table(self.tableframe, dataframe=pd.DataFrame(), width=300, height=400)
Self.tableframe = tk.Frame(self.rightframe, highlightbackground="blue", highlightthickness=5) Self.button3 = tk.Button(self.rightframeheader, text='Generate Plot', command=self.generatePlot, width=10) Self.button2 = tk.Button(self.rightframeheader, text='Clear', command=self.clear, width=10) Self.button1 = tk.Button(self.rightframeheader, text='Import CSV', command=self.import_csv, width=10) Self.rightframeheader = tk.Frame(self.rightframe, background="white") Self.leftframe = tk.Frame(self.main, background="white") Self.rightframe = tk.Frame(self.main, background="white") Self.main = tk.Frame(master, background="white") Additional settings can also be applied here, some of which we will discuss later.įrom _tkagg import FigureCanvasTkAggįrom tkinter.filedialog import askopenfilename Shown above is the remaining configuration settings, such as name, description, file paths, and version numbers. executables = [Įxecutable('graphingapp.py', base=base, target_name = 'app') For console applications, we use “console” instead of “Win32GUI”. The base here specifies that our program is a GUI based one. base = 'Win32GUI' if sys.platform='win32' else None This helps reduce the final EXE size, and speed up load time. The second list is for when we wish to exclude certain libraries, which are being detected by cx_Freeze, but are not needed in our application. cx_Freeze will automatically detect 90% of your dependencies/packages, but there are certain situation in which we need to explicitly declare some of them in this list. The first one is a list of packages you wish to include. Lets discuss the cx_Freeze setup file and its contents briefly. Tutorial: How to configure cx_Freeze Setup.py Key differences between Python and Golang. The resulting Golang code from the conversion will be displayed in the output box. To use this converter, take the following steps - Type or paste your Python code in the input box. Now we have ourselves a setup file, which looks like this. This free online converter lets you convert code from Python to Golang in a click of a button. It’s asking you for the name of the setup file, which is setup.py by default. The last question above can be left as blank (just press enter). (C)onsole application, (G)UI application, or (S)ervice : G Python file to make executable from: graphingapp.py Shown below are the questions we were asked, and our answers. It will ask you several questions, and then create a setup file based on your answers. Cx_Freeze gives us an easy way to create a setup file with default settings using the below command. The setup file on the other hand, can be re-run instantly as all settings are permanent there.Īll you need to do is create a file called “setup.py” and insert the appropriate code. This is especially annoying if you have many special configurations and settings enabled (which is quite common when using cx_Freeze). However, we do not recommend the console approach, because you need to re-enter the commands each time you want to compile. Another common approach is to do everything on the console, without having to create a setup file. There are several ways of working with cx_Freeze, but the easiest to manage is using a setup file. Once we are done with the installation, we can begin converting our Python file to an EXE. First, we are going to install cx_freeze using pip (you can use any equivalent method).