PyInstaller Tutorial to Compile & Bundle Python Script to EXE File in Terminal
213 views
Jun 3, 2025
Get the full source code of application here:
View Video Transcript
0:00
uh hello guys uh welcome to this video
0:02
so in this video I will show you how to
0:05
convert a Python script into a
0:08
executable file so that you can use open
0:12
it
0:13
inside Windows executable so I will show
0:17
you a library which directly converts
0:20
your Python file into and compiles it
0:24
into a executable
0:27
so as you can see here we are having
0:30
this simple Python script which is
0:32
actually a countdown timer right
0:35
here so if I run this Python script it
0:39
will ask me
0:42
to enter the
0:45
time in seconds and as soon as I enter
0:49
the let's suppose I say 8 so then the
0:53
countdown timer will start here and it
0:55
will look something like this
1:00
so it's a very simple kind of an
1:02
application which runs in the terminal
1:04
and which accepts the number of seconds
1:06
from the user and then it actually
1:11
shows the countdown terminal from that
1:15
very simple application so now I just
1:18
need to convert this into an executable
1:20
so that I don't need to execute this
1:24
from the terminal i can just rightclick
1:27
and open it like a normal application so
1:30
for this we actually have a package
1:33
inside Python which you can install it's
1:36
called as pi installer p Y I
1:41
N so this is actually the package you
1:44
just need to install this package pi
1:46
installer uh the command is very simple
1:49
pip install pi installer to install this
1:52
i have already installed this package so
1:55
once you install this you simply
1:59
execute the command
2:06
here let me just delete this
2:09
everything so now we only have this
2:11
simple Python file present so just go to
2:15
your terminal after you install this by
2:18
executing this command pip install pi
2:22
installer so simply execute this command
2:24
to install this module i've already
2:26
installed
2:28
it and then just execute this command pi
2:32
installer followed by the name of the
2:36
script and then just type here d-
2:41
console dash one
2:44
file as this is a console kind of it's a
2:48
console application that's why I'm
2:50
including console here d-ash
2:53
console so pi
2:56
installer this is your python file name
2:59
which needs to be compiled to an
3:01
executable d- console-1 file so just
3:05
enter it and now on the left hand side
3:08
you will see it will create a bunch of
3:11
folders and
3:13
inside that it will have your exe file
3:16
so just this will just hardly take 5 to
3:19
10 seconds and the overall process will
3:21
be complete and you will get this
3:23
notification that build is
3:26
completed and your Python file has been
3:29
compiled to an exe file
3:32
so so there will be this uh build folder
3:36
created you don't need to go to the
3:38
build folder just go to the dist folder
3:41
and if you open the dist folder you will
3:43
find your file has been successfully
3:45
converted from python file to executable
3:48
file so it's converted into an exe file
3:53
uh you can simply open this and now your
3:55
application opens directly as soon as
4:00
you we are opening it like a normal exe
4:04
kind of an
4:05
application and
4:08
again you again need to enter the time
4:11
in seconds so if I just type here 15 so
4:15
the countdown to timer will start here
4:17
from 15 14 13
4:21
12 so after it reaches 00 it will print
4:25
out the
4:27
message so this application can be
4:29
anything it can be any sort of
4:31
application the process will remain the
4:34
same you actually first of all install
4:36
the pi installer and just execute this
4:39
command
4:41
to compile your Python application
4:45
bundle it into an executable so the
4:47
command will remain the same it can be
4:49
any sort of web applic Python Python
4:53
script so in this way you can convert
4:55
your Python script into an EXE file so
4:58
thank you very much for watching this
5:00
video and also check out my website
5:04
freemediatetools.com
5:06
uh which contains uh thousands of tools
#Scripting Languages