Python on Windows

Python does not come pre-installed with Windows. It needs to be manually downloaded and installed. You can get Python from the following: http://python.org/download/. Simply download the Python installer and follow the instructions. Make sure to remember the directory you used to install Python. You may need this information at the top of each of your Python scripts depending on what type of environment you are using to execute the scripts.

Python programs can be created using any text editor such as EditRocket. Python programs and scripts typically end with the .py extension. EditRocket will automatically recognize files with the .py extension as Python programs, and will color the syntax accordingly.

To create a Python program, simply create a new file, such as hello.py. In the file, place the following:

import sys
sys.stdout.write("Hello, world!\n")

The above script can be executed using the EditRocket Tools -> Python -> Execute Program option, or you can execute it from the command prompt. To execute the script via the command prompt, use the cd command to cd to the directory where the hello.py file was saved, such as

cd C:\Scripts

Then type the following:

C:\Python\python.exe hello.py

Hello World! should then be printed to the screen.

For more information about runing Python programs via a local Apache web server, see the following:

Running Python with the Apache Web Server on Windows