Python Setup
Working with Python begins with installing the Python interpreter, which is responsible for executing your code. Python runs on all major operating systems—Windows, macOS, and Linux, and can be easily downloaded from the official website.
Need for Python Installation
To build software or applications using Python, two components are essential:
1. Python Interpreter
- The interpreter reads and executes Python code.
- Without it, your computer cannot understand or run
.pyfiles.
2. IDE (Integrated Development Environment)
An IDE provides a user-friendly workspace where you can:
- Write code
- Test and debug programs
- Run Python scripts efficiently
Popular IDEs for Python
- Python IDLE – comes pre-installed with Python
- PyCharm (JetBrains) – most widely used and feature-rich IDE for Python
- VS Code – lightweight and highly customizable
- Anaconda (Spyder / Jupyter) – preferred for data science
Installing Python
Step 1: Check if Python is Already Installed
Open Command Prompt (CMD) and run:
python --version
python3 --versionIf you see an error like this, then Python is not installed:
Python was not found; run without arguments to install from the Microsoft Store...Step 2: Download Python
-
Visit the official website: https://www.python.org/downloads/
-
Download the latest stable Python version (e.g., Python 3.13.5).
-
Choose the correct installer:
- Windows 64-bit → Recommended for most systems (Intel i5/i7, AMD Ryzen)
- ARM version → Only if your device specifically supports ARM
Check the option "Add Python.exe to PATH" during installation. This ensures Python commands work in the terminal.
Step 3: Verify Installation
Open Command Prompt / Terminal and run:
python --versionor
python3 --versionIf installed correctly, it will display something like:
Python 3.13.5Running Python Code
You can run Python programs in the following ways:
1) Python Interactive Shell (REPL)
Start Python directly in the terminal:
> python
>>> print("Hello")
HelloThis mode is great for testing small code snippets.
2) Running Python Files (.py)
For multi-line code:
- Open an editor or IDE
- Write your Python code
- Save the file with the .py extension, e.g.,
Demo.py
Navigate to the folder in your terminal:
> cd path/to/folder
> ls # show filesRun the script:
> python Demo.pyOutput:
HelloImportance of the .py File Extension

The .py extension plays a vital role in Python programming. It identifies a file as a Python script and ensures that tools, interpreters, and IDEs handle the file correctly. Without this extension, the Python interpreter and development tools cannot treat the file as executable Python code.
1. Recognized as Python Source Code
Files ending with .py are automatically understood by the Python interpreter as Python scripts.
This allows commands like:
python script.pyto execute the file successfully.
2. Full IDE Support (Syntax Highlighting, Debugging, Intellisense)
IDEs such as PyCharm, VS Code, and IDLE depend on the .py extension to enable:
- Syntax highlighting
- Code suggestions
- Error detection
- Debugging tools
A file saved as .txt will not receive these features because the IDE does not treat it as Python code.
3. Modules and Imports Work Only With .py Files
Python’s import system recognizes only .py files as modules.
For example:
import utilswill work only if the file is named:
utils.pyIf it is utils.txt, Python cannot import it.
| File Name | Recognized as Python Code? | Executable? |
|---|---|---|
✅ script.py | Yes | Yes |
❌ script.txt | No | No |
Written By: Muskan Garg
How is this guide?
Last updated on
