Python2Exe User Manual

Sep 17 2019


About This Program
System Requirements
Contacting us for support
Application Notes
Release History

About This Program

Python2Exe is a command line program for converting python scripts to executable files.

This allows you to create stand alone programs in that do not require the python interpreter. You can ship the executable file without having to ship your source code.

Using Python2Exe


This will convert a script named to example.exe.


‑v Print list of modules used
‑v=from Print location where the module was referenced
‑register This option allow you to enter registration information for Python2Exe. You will be prompted for a registration key.
‑opt Optimization: Build smaller executable. Skips imported modules from indented code

Bundling files into your executable

The Bundle feature of Python2Exe allows you to bundle or package any file into the exeutable file, then at run-time extract the file to a specified directory.

To bundle the file use the #p2x_bundle pragma in your source code. Examples:
#p2x_bundle foo.txt
#p2x_bundle ..\web\foo.txt
#p2x_bundle ..\\web\\foo.txt
#p2x_bundle ../web/foo.txt
#p2x_bundle w:\dev\pab\src\todo.txt

To extract the file use the following code:
import pxarchive
pxarchive.unbundle("foo.txt", dir)

System Requirements

Windows version:
Any 32 bit or 64-bit Windows system. including Windows 7, Windows 10 etc.

You will also need a version of Python installed.


Before running the installer make sure that you have already installed a copy of Python 2.x or 3.x.

Run the installer program and follow the prompts.

Several files will be copied to the directory where python.exe is located. To uinstall run python2exe_uninstall.bat. This is a batch file located in the same directory as where python.exe is located.

Contacting us for support

If you are having trouble getting your executable to run, please send us the following information:

The script
Please strip the script down to the minimum needed to reproduce the problem. Ideally it should be a single script that does not require any special modules or instructions. The output produced by 'py2exe -v'
You can save the output to a file with the commands ' py2exe -v > foo.txt' Do not send the binary executable
The output produced by 'python -V'
You can save the output to a file with the commands 'python -V >> foo.txt' The error messages produced by running your generated executable
You can save the output to a file with the commands 'yourscript >>foo.txt' The expected output of your script produced by running it with the python interpreter Optionally any data files etc. required by the script.

Please send the text files in the body of the main email message, or as attachments to the email message.
Give text files a filename of *.txt. Do not place the text files in a zip or tar file.

Application Notes

1. Building your executable
Build your script with the command:

Python2Exe will scan your source code for import statements.
Imported source files and loadable pyd dll files will be automatically compiled into the executable file.
On Windows python.exe must be in your path.

2. Python2Exe performance
Programs created with Python2Exe will run at about the same speed as Python scripts run with the standard interpreter.

Release History

* Sep 17 2019
Initial release


You should carefully read the following terms and conditions before using this software. Unless you have a different license agreement signed by IndigoStar Software, your use of this software indicates your acceptance of this license agreement and warranty.

All rights not expressly granted in this license agreement are reserved entirely to IndigoStar Software

Governing Law

This agreement shall be governed by the laws of the Province of Ontario, Canada.

Limited Warranty

IndigoStar Software represents and warrants that the software and accompanying files will operate and function as documented, and that IndigoStar has full and sufficient right, title and authority to assign or grant the rights and/or licenses granted under this License Agreement. IndigoStar further warrants that neither the Software nor accompanying files infringe any intellectual property rights or similar rights of any 3rd party and agrees to indemnify you for any loss or damage related to a claim of infringement.

Except for these limited warranties, this software and the accompanying files are sold "as is" and without warranties as to performance of merchantability or any other warranties whether expressed or implied. Because of the various hardware and software environments into which Python2Exe may be put, NO WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE IS OFFERED. Good data processing procedure dictates that any program be thoroughly tested with non-critical data before relying on it. The user must assume the entire risk of using the program. Except for claims based on breach of the limited warranties or the indemnity provided above, the liability of either party for claims arising under this Agreement will be limited exclusively to the amount of fees paid under this agreement.

Registered Version

Each registered copy of Python2Exe may be used by a single user to create an unlimited number of executable files. Executable files generated by the registered version of Python2exemay be distributed without restriction.

Trial Version
You are hereby licensed to use the trial version of Python2Exe for evaluation purposes without charge for a period of 30 days.
This is not free software. If you use this software after the 30 day evaluation period a registration fee is required. Under no circumstances are you licensed to distribute Exe files created by the shareware evaluation version of Python2Exe. Unregistered use of Python2Exe after the 30 day evaluation period is in violation of copyright laws.

Distribution of Python2Exe

You are hereby licensed to make as many copies of the trial version of this software and documentation as you wish; give exact copies of the original trial version to anyone; and distribute the trial version of the software and documentation in its unmodified form via electronic means. You may not charge for any of the above. You are specifically prohibited from charging, or requesting donations, for any such copies, however made; and from distributing the software and/or documentation with other products (commercial or otherwise) without prior written permission.