How to Run Python Files in Python Shell
Python is a higher-level programming language that gained popularity among programmers for its ease of use, portability and lack of syntax rules. Python programs, or scripts, can be written in any text editor, and are compiled on-the-fly when the script is run, eliminating the need for a separate compiler to write and run Python programs. Although you can run Python from the command line, you can also run it from within its own command line interpreter or shell, called IDLE.
Instructions
-
-
1
Install Python if it is not already installed. Select the correct version for your operating system from python.org. Linux systems often have Python already installed. However, the default installation of Python does not always include IDLE. Use your distribution's package manager to install the latest version of Python, along with all of the optional libraries and the IDLE application.
-
2
Start IDLE. On a Windows computer, Click “Start,” “Programs,” “Python” and “IDLE (Python GUI).” On a Mac, IDLE is located in your Applications folder, inside the Python folder. IDLE's location may vary according to your Linux distribution, but is most likely inside the “Applications > Programming” folder, accessible from your main menu bar.
-
-
3
Open the Python script you wish to run by clicking “File” and “Open,” then browsing to the location of the script.
-
4
Click “Run Module” from the “Run” menu once the Python script is loaded into memory. The script opens inside a new shell window, or inside its own GUI, if the script is written that way.
-
1
References
- Learning Python; Mark Lutz; 2008