Cxfreeze a python module into exe

Some times one have to turn python modules into executable files to be distributed into a computer without the Python environment. Normally this would be a pain, but with cx_freeze this has become a breeze.

I’ll just list out the steps here in Windows for reference.

1- Install cx_freeze on your computer. The easiest way to do this is with the following command (note that you have to have pip, which comes prepackaged with Python 3.x).

Ensure that pip and python is on your PATH environmental variable

$>pip install cx_freeze

2- Navigate your command shell to the directory of the module. Say, I have a module emailparser.py in the C:\Users\User\Github\emailutil folder.

use the cd command in your shell to change directories.

3- Use the cx_freeze module to transform your python file to a executable.

Ensure that the directory of your cx_freeze script (most likely in Python\Scripts) is on your PATH

Assuming the same file, emailparser.py, as in (2).

$>cxfreeze emailparser.py

Voila! It’s done. It will be in a folder called dist.

Further documentation here.

 
1
Kudos
 
1
Kudos

Now read this

Melee attack

I guess the rewrite has paid off a little, when I added a new attack, I only had to add a new weapon as the claw by duplicating the original chest gun, change the name, the texture for this attack and a new script for the behavior. A... Continue →