Game Development Reference
In-Depth Information
You may want to share the game programs you make with other people. Having other
people play your games is a great way to show off your skills. However, they may not have
Python installed on their computer. There is a way to run Python programs without
installing the Python interpreter: You will have to compile your .py script into a .exe
executable program.
Compiling source code means converting that source code into machine language, which
is the programming language your computer understands. Programming in machine
language is very long and tedious, and higher-level languages such as Python make
programming easier.
This appendix will show you how to compile your .py Python files into .exe programs
that can be run on Windows without having Python installed.
Step 1: Download and Install py2exe
First, you will need to download and install a module called py2exe from
http://sourceforge.net/projects/py2exe/files/. Be sure to download the correct version of
py2exe for your version of Python. (For example, download py2exe-0.6.9.win32-py2.6.exe
if you have installed Python 2.6 on your computer.)
The py2exe module only works on 2.x versions of Python, and not Python 3. You will
have to convert your programs to run on Python 2 if you have written them for Python 3.
This is fairly easy. There are not many differences between Python 2 and 3, and they are
documented in Appendix A of this topic.
After downloading the py2exe installer, double click on it to install it. This installation is
Search WWH ::




Custom Search