
In my case, I went back to the location where I originally stored the ‘hello’ script (C:\Users\Ron\Desktop\MyPython).


Your executable should now get created at the location that you specified. Once you’re done, press Enter for the last time. Since in our example, the pythonScriptName is ‘ hello‘, then the command to create the executable is: pyinstaller -onefile hello.py Next, use the following template to create the executable: pyinstaller -onefile pythonScriptName.py This is how my command looked like (don’t forget to press Enter after you typed the location where the Python script is stored on your computer): In my case, I typed the following in the command prompt: cd C:\Users\Ron\Desktop\MyPython Simply go to the Command Prompt, and then type:Ĭd followed by the location where your Python script is stored Now you’ll be able to create the executable from the Python script using pyinstaller. Step 5: Create the Executable using Pyinstaller Where I named the Python script as ‘hello’ I then saved the Python script in the following folder: Label1 = tk.Label(root, text= 'Hello World!', fg='green', font=('helvetica', 12, 'bold'))Ĭanvas1.create_window(150, 200, window=label1)īutton1 = tk.Button(text='Click Me',command=hello, bg='brown',fg='white')Ĭanvas1.create_window(150, 150, window=button1) Now you’ll need to save your Python script at your desired location.įor illustration purposes, I created a simple Python script that will display ‘Hello World!’ when clicking the button: import tkinter as tkĬanvas1 = tk.Canvas(root, width = 300, height = 300)

TURN PYTHON TO EXE ONLINE INSTALL
In the Windows Command Prompt, type the following command to install the pyinstaller package (and then press Enter): pip install pyinstaller To start, you may want to add Python to Windows path.Īn easy way to add Python to the path is by downloading a recent version of Python, and then checking the box to ‘ Add Python to PATH’ at the beginning of the installation: Steps to Create an Executable from Python Script using Pyinstaller Step 1: Add Python to Windows Path
TURN PYTHON TO EXE ONLINE FULL
If so, I’ll show you the full steps to accomplish this goal in Windows. If we click the "Click" button, it will display a greeting message on the screen.Looking to create an executable from Python script using pyinstaller? When we run the exe file, it will display a window that contains an entry widget. It will affect the directory ( dist folder) where all executable file will be placed automatically.
TURN PYTHON TO EXE ONLINE CODE
Now, run the above command to convert the given code into an executable file. Ttk.Button(win, text= "Click", command= myclick).pack(pady=20) #Stop the frame from propagating the widget to be shrink or fit Label= Label(frame, text= message, font= ('Times New Roman', 14, 'italic'))įrame = LabelFrame(win, width= 400, height= 180, bd=5) In this example, we have created an application that will greet the user with their name by displaying the message on the screen. When we run the file, it will display the window of the tkinter application. Now, check the location of the file (script file) and you will find a dist folder which contains the executable file in it. Now, type pyinstaller -onefile -w filename and press Enter.

Install pyinstaller using pip install pyinstaller in Windows operating system. Once installed, we can follow the steps to convert a Python Script File (contains a Tkinter application file) to an Executable file. To work with pyinstaller, first install the package in the environment by using the following command, pip install pyinstaller We can convert any tkinter application to an exe compatible file format using the PyInstaller package in Python. Let us suppose that we want to create a standalone app (executable application) using tkinter.
