How to Run a Python Script From a Prompt
The Python programming language can be used as a scripting language on the Windows, Linux, Unix and Mac OSX operating system. Scripts can be created in any plain text editor such as Windows Notepad, Gedit or TextEdit. The scripts can be executed from the command line on any of the operating systems. When the script completes the command prompt will return. Python is installed natively on most Linux distributions. It must be downloaded from the Python website and installed on the Windows and Mac OSX operating systems.
Instructions
-
-
1
Type the script into a plain text editor and save it with the ".py" file extension.
-
2
Open a command prompt window in Windows or a terminal window in Linux, Unix or Mac OSX.
-
-
3
Navigate to the directory that contains the Python script.
-
4
Type the command "python script_name.py" to execute the script. Replace "script_name" with the name you gave the script.
-
1