3 Free Python to EXE Converter Software for Windows

0 Comments
Editor Ratings:
User Ratings:
[Total: 0 Average: 0]




Here are some best free tools that as a Python developer you can use for packing your source code into executable files. I will talk about some best free Python to EXE converters that you can use. These tools take your Python script as input and then turn it into native Windows binary that you can run on any Windows machine. The best part is that the finally generated EXE file will not require Python to be installed on the PC in order to run.

Most of the tools here are open source as well. You can inspect their source code and then simply make up of your mind which one you want to use. One of the tools here can also generate single EXE file without the auxiliary or helper libraries if you want to. However, one thing you have to note is that once you convert your script to Windows EXE, it’s size will increase exponentially. The final EXE file can be hundreds or thousands time the size of the original Python script.

3 Free Python to EXE Converter Software for Windows

auto-py-to-exe

auto-py-to-exe windows binary generator

auto-py-to-exe is one of the best free Python to EXE converter that you can use. Here it is a GUI based tool that takes a script file from you and then generates the corresponding EXE file. It lets you generate a single self-contained executable or EXE with the helper files. Basically, it depends on PyInstaller and one can say that it is the GUI for PyInstaller.

Using GUI to create executable files is far easier than using the command line. You don’t have to remember a complex syntax as well as long commands. You just launch it whenever you want and then convert any Python file to Windows EXE. However, one downside of PyInstaller is that the EXE files that it generates can be decompiled to get the original script.

To install, you just type pip install auto-py-to-exe in the command prompt and then launch it by typing its name. Its mail UI will show up. Next thing you need to do is locate the Python file that you want to convert through it. After that, you select the necessary options from the main interface and then start the process. Depending on what options you choose, it will generate the PyInstaller command for you. Finally, start the Convert button at the bottom and wait for it to generate the EXE file that you can share with anyone.

PyInstaller

PyInstaller is a popular cross-platform binary generator from Python code. In fact, the tool above uses this underneath. Good things are that it can be used in standalone mode. You can use it as a module to convert your Python program or script to native platform binary. If you use it on Windows then it will create EXE file. And if you use it on macOS and Linux then it will create the equivalent binaries.

Just like the tool above PyInstaller is also open source. It has a lot of command line arguments that it takes to generate a customized binary. You can exclude certain packages from being included in the final binary. In addition, there are explicit options to generate a single self-contained binary or with auxiliary files. The only problem with this is that it packs the entire Python library in the executable. And hence the finally binary will be quite large in size.

There is an online documentation available for it that you can go through to see all the supported parameters. But the very basic command to generate a binary from Python script or program is this.

Syntax: pyinstaller --onefile PythonFileName

Example: pyinstaller --onefile ilfs.py

pyinstaller in action

If you want to exclude some packages from being packed into the EXE file then you can add an extra argument, “–exclude-module”. See the usage below.

Syntax: pyinstaller --onefile PythonFileName--exclude-module ModuleName

Example: pyinstaller --onefile ilfs.py--exclude-module Matplotlib

Similarly, you can look up for other switches that it supports and then supply them in the command to generate the binary accordingly. It will take some time to generate the binary and after it is done, you will find the EXE file in the “dist” folder that it will automatically create in the current working directory.

py2exe

py2exe is another free and open-source tool that lets you convert Python to EXE for free. However, here it doesn’t generate a single self-contained binary file. For this work, you will have to create a separate script in order to generate binary. But that is very easy to do. There is a detailed docs available where you can learn the simple as well as advanced usage.

Here are the steps to generate EXE for a Python script file. You will need setuptools for it to work. But Python has that already installed as one of the built-in modules.

Step 1: Prepare your script file. Make sure that everything works.

Create script

Step 2: Now, you create a setup.py file in the folder. Paste the following contents. Just replace name of your script in it. Remove test.py from it and enter the name of the script that you wish to convert to EXE.

from distutils.core import setup
import py2exe
setup(console=['ScriptName'])

setup.py file for script

Step 3: Run this command to pack the script in an EXE file. After it is done, you will see a “dist” folder in the current working directory. Here among the auxiliary files, you will find the newly generated EXE file.

python setup.py p2exe

py2exe EXE file binary generated

This is how you can generate EXE file for any Python script for free. But there is a chance that py2exe is not available on your PC already if that’s the case, then you need to run pip install py2exe t install it. After it installs successfully, you just follow the steps above.

Here I have used a very basic syntax and test file. But you can learn more about in the docs to understand the more sophisticated usage of the tool.

Final thoughts:

If you are looking for Windows binary creator from Python scripts then here are some tools that you can use. As a software developer, if you are creating some app for Windows desktop then these tools will help you release your software. However, with these tools, you will not be able to distribute a commercial software written in Python due to de-compilation problem. But as an open-source developer, it will not be a problem.

Editor Ratings:
User Ratings:
[Total: 0 Average: 0]

Get 100 GB FREE

Provide details to get this offer