How do I make an executable from a Python script?

To make an executable from a Python script, you need to install the PyInstaller library.

Install the PyInstaller Library

To install the PyInstaller library, use the pip in Python. Type the below command on Command Prompt and press Enter −

pip install pyinstaller

Our Python Script

Let’s say we have the following Python Script, wherein we have displayed checkbox using Tkinter. Our file is saved on the Desktop with the path −



Here’s the code of

import tkinter from tkinter import * top = tkinter.Tk() CheckVar1 = IntVar() CheckVar2 = IntVar() C1 = Checkbutton(top, text = "Cricket", variable = CheckVar1, \ onvalue = 1, offvalue = 0, height=5, \ width = 20) C2 = Checkbutton(top, text = "Football", variable = CheckVar2, \ onvalue = 1, offvalue = 0, height=5, \ width = 20) C1.pack() C2.pack() top.mainloop()


Create an Executable

Now, we will use the PyInstaller library to create an executable of our Python script

Open cmd and reach the location wherein the script is located −

Now, type the following command with the name of the script file −

The above will create an executable, which will be the executable from the file.

Updated on: 20-Sep-2022


Kickstart Your Career

Get certified by completing the course

Get Started