I\'ve been searching through SO for a while now trying to come up with an answer to this but due to my inexperience with programming I don\'t understand much of the document
Install pyinstaller, a program that converts .py to .exe for python 2.7 to where python is located:
cd C:\python27\scripts
pip install pyinstaller
then move whatever python file you want to compile to C:\python27\scripts, compile from there by using:
pyinstaller --onefile yourfile.py
the --onefile is optional but it packages the whole thing(in this example yourfile.py) into one .exe. Once everything is done there will be 2 new folders along with a .spec file. From C:\python27\scripts open the folder dist. Your .exe will be located there in one file which you can double tap to execute and distribute to anyone who doesn't have python. Hope it helps.
Python scripts can be made directly executable, like shell scripts, by putting the python environment path in the top of the script file.
#!/usr/bin/env python3.5
The Python installer automatically associates .py files with python.exe so that a double-click on a Python file will run it as a script. The extension can also be .pyw, in that case, the console window that normally appears is suppressed.
Detailed description also for linux is here.
from distutils.core import setup import py2exe setup(console=['Avril.py'])
cd C:\Python27\
python setup.txt py2exe
Source: Manvir Singh
There are two distinct ways of freezing python scripts to create executables:
The point where you have to start is reading the documentation. Such tools are not just push-and-run style tools, they usually have some configuration that must be implemented (that's the problem of possibly all build systems, and as the project grows, the configuration and number of hooks also grows).
You can start with Py2exe tutorial and 'hello-world' to get acquainted with that how compilation is done. As far as I know it's a simplest way to get your goal.
And the last thing, you can't create cross-platform native executables as their file formats are strongly operating system and hardware dependent.