Installing Python + VS Code — environment setup
WHAT are we actually installing?
WHY two pieces? Because writing and running are different jobs. Many editors exist (PyCharm, Sublime, even Notepad); many ways to run Python exist (terminal, IDE). Keeping them separate makes the system flexible.
HOW the pieces fit together

HOW to install — step by step
Step 1 — Install the Python interpreter
- Go to python.org → Downloads and get the latest stable version (e.g. Python 3.12).
- Run the installer. ✅ CHECK the box "Add Python to PATH" at the bottom.
- Why this step? Without it, your terminal won't recognise the word
python, and you'll get "python is not recognized". PATH is how the OS finds the program.
- Why this step? Without it, your terminal won't recognise the word
- Click Install Now.
Verify it (Active Recall the machine!): open a terminal and type:
python --version
Expected: Python 3.12.x. (On macOS/Linux you may need python3 --version.)
Step 2 — Install VS Code
- Go to code.visualstudio.com, download for your OS, install (defaults are fine).
- On Windows, tick "Add to PATH" so you can type
code .to open a folder.
Step 3 — Connect the two (the part people forget)
- Open VS Code → Extensions (the four-squares icon) → search "Python" (by Microsoft) → Install.
- Why? This gives the green Run ▶ button, syntax help, and the interpreter selector.
- Open a folder for your project: File → Open Folder.
- Select interpreter: press
Ctrl/Cmd+Shift+P→ type "Python: Select Interpreter" → pick your Python 3.12.- Why this step? You may have several Pythons; this tells VS Code which brain to use for this project.
Step 4 — First program
Create hello.py:
print("Hello, world!")Press Run ▶. The terminal shows Hello, world!.
Why this step? It proves all three layers work: editor saved the file, interpreter is found, output flows back.
Step 5 (best practice) — A virtual environment
In the VS Code terminal:
python -m venv .venv
Then select .venv as the interpreter (VS Code usually prompts you).
- Why? So installing a library for this project (
pip install requests) never breaks a different project. Isolation = no version wars.
Steel-man your mistakes
The 80/20 — what actually matters
Recall Feynman: explain to a 12-year-old
Imagine you want to write and read letters in a secret language. Python is your friend who understands the secret language — you hand him a note and he reads it out loud. VS Code is your nice desk with good pens and a lamp where you write the notes neatly. The desk doesn't understand the language — it just helps you write. So you need BOTH: the desk to write, the friend to read. "Add to PATH" is like putting your friend's phone number in your contacts so you can call him instantly by name from anywhere in the house.
Flashcards
What two separate things must you install for Python development?
Why must you tick "Add Python to PATH" during installation?
python command from any terminal; otherwise you get "python is not recognized".What does VS Code actually do when you press Run?
What command verifies your Python install and version?
python --version (or python3 --version) → prints Python 3.x.x.What is the VS Code "Python: Select Interpreter" command for?
What is a virtual environment (venv) and why use it?
python -m venv .venv, so projects' dependencies don't clash.On macOS/Linux, what do you try if python says "command not found"?
python3 (and pip3); the system often doesn't map plain python.What does the Microsoft Python extension add to VS Code?
Connections
- Python Interpreter vs Compiler
- The Terminal and Command Line Basics
- pip and Package Management
- Virtual Environments (venv)
- Your First Python Program — print()
- PATH Environment Variable
Concept Map
Hinglish (regional understanding)
Intuition Hinglish mein samjho
Dekho, sabse pehle samajh lo ki Python aur VS Code do alag cheezein hain. Python ek interpreter hai — yeh asli mein tumhara code padhta aur chalata hai, isko "dimaag" samajh lo. VS Code sirf ek acha sa editor hai jahan tum code likhte ho, comfortable typing, colors, autocomplete ke saath — isko "haath" samajh lo. Bahut log galti karte hain ki sirf VS Code install kar lete hain aur sochte hain Python bhi aa gaya — nahi bhai, dono alag se install karne padte hain.
Install karte waqt sabse important baat: python.org se installer chalao aur "Add Python to PATH" wala box zaroor tick karo. Yeh PATH cheez tumhare operating system ko batati hai ki python command kahan dhoondhni hai. Agar tick nahi kiya, to terminal bolega "python is not recognized" — bas yahi sabse common dard hai beginners ka. Verify karne ke liye terminal mein python --version likho; agar Python 3.x.x aaya, to interpreter sahi laga.
Phir VS Code install karo, uske baad Extensions mein jaake Microsoft ka Python extension install karo — yeh green Run button aur interpreter selector deta hai. Ctrl+Shift+P daba ke "Python: Select Interpreter" chuno taaki VS Code ko pata chale konsa Python use karna hai. Last mein har project ke liye python -m venv .venv se ek virtual environment banao, taaki ek project ki library doosre project ko na todge. Bas itna — interpreter, editor, extension, select, verify, venv. Yeh 20% setup hi 80% kaam aasaan kar deta hai.