To see if your computer has Python installed, try this:
In your My Documents folder (or Desktop), use Notepad to make a file named Hello.py and place in the file the single line,
raw_input("hello")Then, try double clicking on the file's icon to start the program. If it displays a new command window and prints hello, you have it.
Or, from the Start menu, use Search to search all files and folders for the file, python.exe. If the search command finds it, it will show you where.
If Python exists, you will see the directory path to it.
Important: your computer must have Python version 2.4 or newer but not Python 3.0 or newer (which is a brand-new release that is incompatible with all previous versions, alas).
If you must install Python, you will find it easy. Go to http://www.activestate.com/Products/ActivePython, click on ``Download Now'', fill in your name and address, then download and install Python Version 2.6; it's available for Windows, Mac OS/X, Linux, etc.
Try your implementation by using Notepad to make a file named Hello.py and place in the file the single line,
raw_input("hello")Then, try double clicking on the file's icon to start the program. If it starts and prints hello, you are good to go. (Or, try starting the program from a command window, like this: python Hello.py)
If you are a Linux hacker, starting a program by typing a command in a command window is old news to you. (So, just do it.) For this reason, the remainder of this note is oriented to Windows users who have less experience with command windows and environment variables:
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 important to learn how to start Python from a command window. First, try this experiement:
python
If you see
Python 2.6 (#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:\Python26), 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:\Python26(Use the path you just discovered!) This tells the command window to find the Python interpreter, python.exe, in the folder, C:\Python26.
Now, type
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 knows once and for all the path to Python. Here is what you must do on Windows XP to reset the PATH variable:
;C:\Python26
If you use Windows Vista, you must still find your way to the Environment Variables table within your computer. Use your Help facility to search for information about Environment Variable.