Say that you have installed Python on your computer. The standard way to use it to write and test programs is with a command window. (After you have the program operating correctly, then you can execute it by double-clicking on the program's icon.)
So, it is most important to learn how to start Python from a command window. First, try this experiement:
If you see
Python 2.4.3 (#1, May 18 2006, 07:40:45) Type "help", "copyright", "credits" or "license" for more information. >>>Then your computer is ready to use Python and you need not read the rest of this note. But if you see the message,
'python' is not recognized as an internal or external command, operable program or batch file.then you must tell Windows XP where to find the Python software that you installed.
If you have no idea where Python was installed on your computer, you must search for it:
Now that you know the path to Python (e.g., C:\Python24), go look for it: Open a file window, find the folder, and open it --- is python.exe inside the folder? It should be! If not, double-check the path information --- you must find the location of the python.exe program to continue. Keep looking till you find it!
Now you are ready to use a command window to execute Python.
To use Python within a command window, do this: Open a new command window and type the set path command:
set path=C:\Python24(Use the path you just discovered!) This tells the command window to find the Python interpreter, python.exe, in the folder, C:\Python24.
pythonYou should see the start-up message for the Python interpreter. Success! Now, exit the interpreter. (Type exit) (If you do not see the start-up message, double-check the path to python.exe!)
Now you are ready to use the same command window to cd to the folder where your Python programs reside, and you can use the Python interpreter to execute them.
Each time you open a command window, you must type the set path command to set the path to Python. It is a bit annoying to do this every time you open a command window, and there is a clever repair --- you can reset permanently the value of Windows's PATH variable so that Windows XP knows once and for all the path to Python. Here is what you must do on Windows XP to reset the PATH variable: