- Podcasts
- CyberCode Academy
- Course 25 - API Python Hacking | Episode 7: Building Windows Executables from Python Scripts with PyInstaller
Course 25 - API Python Hacking | Episode 7: Building Windows Executables from Python Scripts with PyInstaller
CyberCode Academy
- February 28, 2026
- 17 min
About this episodeIn this lesson, you’ll learn about: Converting Python Scripts into Executables Installing and using PyInstaller to package Python code…
- Converting Python Scripts into Executables
- Installing and using PyInstaller to package Python code into standalone .exe files
- Understanding how executables allow programs to run on systems without Python installed
- Compilation Process with PyInstaller
- Using the command pip3 install pyinstaller to install the packaging tool
- Running PyInstaller on a Python script to generate a Windows Portable Executable (PE) file
- Observing how PyInstaller bundles dependencies automatically
- Understanding the Output Structure
- Locating the compiled executable inside the dist folder
- Recognizing supporting files and directories generated during compilation
- Identifying the final executable ready for deployment
- Deployment and Distribution
- Packaging the compiled executable into a ZIP archive for sharing
- Uploading compiled tools to GitHub as part of a professional portfolio
- Distributing tools to systems without requiring Python installation
- Key Outcome
- The ability to convert Python-based security tools into portable Windows executables for real-world deployment and professional use.
You can listen and download our episodes for free on more than 10 different platforms:
https://linktr.ee/cybercode_academy
Get the books of the CyberCode Academy podcast:
📚 The book series: 416 lessons, 12 books, hundreds of original diagrams: security, networking and programming.
https://cybercodeacademy.gumroad.com/
Transcript
From the publisherThis transcript comes from the podcast’s own feed, shown as the publisher wrote it.
Course 25 - API Python Hacking | Episode 7: Building Windows Executables from Python Scripts with PyInstaller
Victory exactly, it works on my machine. But then then comes the reality check. You actually need to get that tool into the hands of someone else. Right, maybe it's a colleague in HR or an IT admin who just needs a quick fix for something, or you know, maybe you're sending it to a client, so you send them the Python script, just the standard dot.
That pause is actually pretty important to understand. When you run that install command, your computer is reaching out to the Python package index. It's downloading the Pine installer wheel, but it's also checking to see if your system has the prerequisites to run pie installer itself. Oh yeah, it's resolving its own dependencies.
This is the analysis face. PI installer scans your entire script. It looks at every single import statement you wrote. If you imported AS or CIS or pandas, it makes a note of that. Then it looks at the detendencies of those libraries. It basically builds a massive graph of everything your script needs to survive.
It comes down to speed and troubleshooting. When you have a folder, the executable is really just a piny launcher. When you double click it, it instantly loads the libraries sitting right next to it in that folder. If you force everything into one single file, which you can do great, Yes you can do it with a specific flag. But if you do, the computer actually have to unpack all those temporary files to a hidden system folder every single time you run the program. It makes the startup time noticeably slower.
It is a heavy hitter in the Windows environment. Cedabug privilege allows a process to inspect and even adjust the memory of other processes. It's exactly what a debugger needs to work. If you have this privilege enabled, you basically have the keys to the kingdom for any program running on that computer.
That is the moment of truth that proves two things for us. One, your logic inside the Python code actually works. But two and way more importantly for this deep dive, the frozen application successfully inherited the ability to make Windows ATI calls. The libraries you used were packed correctly by Pie installer.
But remember the house analogy from earlier. If you drag just the dot X out of that folder, you are basically ripping the front door off the hinges and mailing it to your friend. When they try to open it, there is no house behind it. It will crash instantly because it can't find Python thirty nine, dot dl or any of those other dependency files.
This is perhaps the most common core scenario you'll face. Imagine you are working in a highly secure environment, maybe a bank or a hospital or government contractor the computers there are locked down tight. You cannot just install Python three point DENZERI because you feel like it. You need admin rights that you simply do not have.
Often yes, or at the very least, it is significantly easier to get security approval for a single standalone tool that it is for a widespread system level installation of an interpreted language and its package manager. By freezing the code, you are completely bypassing the need for the end user to configure an environment. You are delivering the solution itself, not the prerequisites for the solution.
Entirely with Pie Installer. It is actively maintained. It supports all the newer versions of Python, and as we saw today, it works out of the box with zero configuration for the vast majority of scripts. There are other modern tools out there, like Nuika or tx freeze, but Pie Installer remains the quick and easy standard for very good reason.
So let's recap the workflow here for everyone listening. It really is a simple loop. Once you get the hang of it. Step one you install the tool with pick three, install pint ste. Step two you navigate your command line to wherever your script lives. Step three you run pinestaller followed by your file name Step four, you ignore all the scrolling terminal noise and just go find that distfolder, the most important folder exactly. Step five you verify it works, check those privileges in task manager, and finally step six you zip the entire folder, not just the file to share it.
Now, before we sign off, I want to throw a little challenge out to you the listener. We've talked a lot about the dependencies and the DLLs living inside that directory. Here is the review question. If you successfully compile your script, but you wanted to send your friend strictly one file, just the dot x, and you still wanted it to work, Pinestaller actually allows this. We mentioned the flag briefly, but based on what we discussed about how the one directory mode works with the computer unpacking files, what do you think the trade off would be if you squashed everything into a one file mode.
