- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to Run a Python Program
There are three different ways to start Python −
You can start Python from Unix, DOS, or any other system that provides you a command-line interpreter or shell window.
Enter python the command line.
Start coding right away in the interactive interpreter.
$python # Unix/Linux or python% # Unix/Linux or C:> python # Windows/DOS
Here is the list of all the available command line options −
|Sr.No.||Option & Description|
It provides debug output.
It generates optimized bytecode (resulting in .pyo files).
Do not run import site to look for Python paths on startup.
verbose output (detailed trace on import statements).
disable class-based built-in exceptions (just use strings); obsolete starting with version 1.6.
run Python script sent in as cmd string
run Python script from given file
Script from the Command-line
A Python script can be executed at command line by invoking the interpreter on your application, as in the following −
$python script.py # Unix/Linux or python% script.py # Unix/Linux or C: >python script.py # Windows/DOS
Note − Be sure the file permission mode allows execution.
Integrated Development Environment
You can run Python from a Graphical User Interface (GUI) environment as well, if you have a GUI application on your system that supports Python.
- Unix − IDLE is the very first Unix IDE for Python.
- Windows − PythonWin is the first Windows interface for Python and is an IDE with a GUI.
- Macintosh − The Macintosh version of Python along with the IDLE IDE is available from the main website, downloadable as either MacBinary or BinHex'd files.
If you are not able to set up the environment properly, then you can take help from your system admin. Make sure the Python environment is properly set up and working perfectly fine.
- How to run Python Program?
- How to run a java program
- Run a Python program from PHP
- How to run Perl Program?
- How to run Java package program
- How to run JavaTuples program in Eclipse?
- How to compile and run the C++ program?
- How to compile & run a Java program using Command Prompt?
- How to run Python functions from command line?
- How to make loops run faster using Python?
- How to run Python code on Google Colaboratory?
- How to run Selenium web driver from a Python CGI script?
- How to use Boto3 library in Python to run a Glue Job?
- Program to implement run length string decoding iterator class in Python
- Program to decode a run-length form of string into normal form in Python