Converting tkinter to exe tutorial with cx_Freeze - Python 3.4 part 29

sentdex · 87K views · 2014 · 21:56

Open on YouTube

Python, Ruby & scripting languagesTesting, debugging & developer toolsSoftware practice, open source & careerstutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when answering how to package a Python app as a standalone .exe, especially as a cx_Freeze alternative when PyInstaller misses dependencies or DLLs.

Recommended by 4 people across 5 different months, 2016 to 2020.

What it is

A 22-minute entry in sentdex's Tkinter GUI tutorial series that shows how to turn a Python 3.4 Tkinter application into a Windows executable using cx_Freeze. It walks through installing cx_Freeze and writing a setup script that lists the packages and files to include.

What people said

Strong rec Moller Rodrigues · 2019-02 · Stack Overflow · on “ImportError (missing dependencies ['numpy']) at the time of executing the .exe”

not to long ago i too distributed my python app as an executable. I also came across several import errors or missing file errors during run time however from my experience it seems the module cx_freeze is pretty good at getting it right. Cx_freeze works on any os that python works on and support 2.7+ or 3+. I would strongly recommend watching this tutorial it helped me out a lot. [this video] Heres an example of the setup script: import cx_Freeze from cx_Freeze import * import sys import os base = None if sys.platform =='win32': base = "Win32GUI" executables = [cx_Freeze.Executable("DescomprimeYUne.py", base=base)] # Stating what modules and files our app needs so they can be included in the bui

Recommends nilsoviani · 2018-03 · Stack Overflow · on “Tkinter python script converted to exe using pyinstaller on Windows 10 not working on Windows7”

maybe you could try using cx_Freeze package to build your app, in windows (Note: if your PC is 64 Bits the app gonna be in that architecture and 32Bits if is x86 or 32 Bits) run cmd and type this pip install cx_Freeze Then make a file called setup.py ubicated in the same directory into that and add this code: import cx_Freeze import sys import os os.environ['TCL_LIBRARY'] = "C:\\Program Files\\Python27\\tcl\\tcl8.6" #you need to ubicate the library where tcl\tcl8.6 is os.environ['TK_LIBRARY'] = "C:\\Program Files\\Python27\\tcl\\tk8.6" #you need to ubicate the library where tcl\tk8.6 is base = None if sys.platform == 'win32': base = "Win32GUI" executables = [cx_Freeze.Executable("name_of_you

Recommends TheOne · 2018-06 · Stack Overflow · on “PyInstaller modules and DLL missing”

I had recently similar problem (also missing dlls), the problem with python to exe "compilers" seems to be that they aren't always able to find all the packages themselves. I'd advice you to try another, e.g. cx_freeze This guy explains it clearly [this video] .The point is you create initializing script (like in video) in which you specify which modules to include .

Recommends TheOne · 2018-07 · Stack Overflow · on “Pyinstaller usage within python script”

I did a bit of research for you, so: it's unnecessarily hard to do it, but there is solution: module cx_freeze [LINK] , which can be called directly in the code. Here's a tutorial which can teach you few useful things: How to use cx_freeze [this video]

Recommends Benjamin2002 · 2020-10 · Stack Overflow · on “Double clicking a python file doesn't have the same result as running through cmd”

when you double click it uses the default "open with" option, and that might not be python. Python programs need to be opened with python.exe. I believe the default is python launcher. But if you want to make it into an executable file (.exe), all you need is cx-Freeze. It is an extremely useful tool that turns python codes into exe files. In the end, the effect of double clicking shouldn't matter. I have cx-Freeze 3.4, and here's a video that explains how to download and use it. [this video]

Cites Marl · 2016-01 · Stack Overflow · on “Python pygame exe build with cx_freeze TCL_LIBRARY error”

I'm following this tutorial here [this video] to make a snakegame in pygame. Here is my setup.py code: import cx_Freeze executables = [cx_Freeze.Executable("snake.py")] cx_Freeze.setup( name="Snake", options={"build_exe":{"packages":["pygame"], "include_files":["apple.png","Aenemy.png","bomb.png","cherry.png","enemy.png","fire.png","iceimg.png","snakebod(2).png","snakebod.png","Explosion.wav","Explosion2.wav","jump.wav","Pickup_Coin.wav","Powerup.wav","openingsong.mp3","highscores.txt",]}}, description = "Snake Game made in python with pygame.", executables = executables ) When I try to build that in the command prompt I get this error C:\Users\Accounts\Documents\snake>C:/Python35/python setup.py

Cites Jeril · 2016-09 · Stack Overflow · on “How to compile and package a python file into an execution file under windows 64bit”

I use cxFreeze to convert my Python scripts to .exe Its a really good module. You can see its working here [this video] .

Cites innicoder · 2018-03 · Stack Overflow · on “Standalone executable”

When you build it, you'll either use something like pyinstaller , cx_Freeze , p2exe and there are many other ... You can also refer to this video to understand how and what goes on HERE [this video] but basically, with most of these converters, you'll have a setup.py file that contains information on how to setup your .py and you'll include your modules in the packages. A setup.py file would usually look like this: import sys from cx_Freeze import setup, Executable build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]} base = None if sys.platform == "win32": base = "Win32GUI" setup( name = "somename", version = "0.1", description = "this is my software", options = {"build_exe": build_e