Wednesday, April 22, 2009

Running Python Scripts from a Command Prompt :

Actually, there are several ways to run your programs. First, let’s assume that you have a DOS 
window or a UNIX shell prompt before you, and that the directory containing the Python exe-
cutable (called python.exe in Windows, and python in UNIX) or the directory containing the 
executable (in Windows) has been put in your PATH environment variable.

Also, let’s assume that your script from the previous section (hello.py) is in the current directory. Then you can execute your script with the following command in

Windows: C:\>python hello.py

OR

UNIX: $ python hello.py

As you can see, the command is the same. Only the system prompt changes.

Note : If you don’t want to mess with environment variables, you can simply specify the full path of the Python interpreter.

In Windows, you might do something like this: C:\>C:\Python25\python hello.py

No comments:

Data Science - 103 (Kapil Sharma)

Cloud Computing Basic:-  In this the PC is on service provider data center and secuirty maintenance and upgrades are done by the service pro...