Learn how to install Visual Studio Code for Python development. Setup Python extension, debugger, linter, formatter and essential tools. VS Code Python setup kaise karein – Hindi mein complete guide.
Hindi: Yeh guide aapko Visual Studio Code (VS Code) install karna aur Python ke liye configure karna sikhayega. VS Code aaj kal sabse popular code editor hai – free bhi hai aur powerful bhi.
🖥️ What is VS Code?
Visual Studio Code (VS Code) is a free, open-source, lightweight yet powerful code editor developed by Microsoft. Released in 2015, it has become the most popular code editor in the world.
Hindi: VS Code Microsoft ka free code editor hai jo 2015 mein release hua tha. Yeh aaj duniya ka sabse popular code editor hai. Iska use Python, JavaScript, Java, C++ aur bahut saari languages ke liye hota hai.
| │ Full Name | Visual Studio Code │ |
| │ Developer | Microsoft │ |
| │ Year | 2015 │ |
| │ License | MIT Open Source │ |
| │ Platforms | Windows, macOS, Linux, Web │ |
| │ Price | FREE │ |
| │ Extensions | 50,000+ available │ |
| │ Website | https://code.visualstudio.com │ |
🎯 Why VS Code for Python?
Hindi: Python ke liye VS Code best editor kyun hai – yahan kuch khaas reasons hain:
| Feature | VS Code | Notepad | PyCharm |
|---|
| Price | Free | Free | Paid (Community free) |
| Python Support | Excellent (via extension) | None | Excellent (built-in) |
| Extensions | 50,000+ | None | Limited |
| Performance | Fast | Very Fast | Slow |
| Git Integration | Built-in | None | Built-in |
| Debugger | Built-in | None | Built-in |
| IntelliSense | Excellent | None | Excellent |
| Multiple Languages | Yes (all languages) | No | Python only |
Key Features for Python:
- 🔍 IntelliSense – Auto-complete as you type
- 🐛 Debugger – Step through code, inspect variables
- 🧹 Linting – Highlight errors before running
- 🎨 Formatting – Auto-format code (Black, autopep8)
- 📁 File Explorer – Manage project files easily
- 💻 Integrated Terminal – Run Python without leaving VS Code
- 🔄 Git Integration – Track code changes
- 🌐 Remote Development – Code on remote servers
Hindi: VS Code mein auto-complete, debugger, linting, formatting, aur integrated terminal sab kuch hai. Ek hi editor mein poora Python development environment milta hai.
⬇️ Download VS Code
🌐 URL: https://code.visualstudio.com/download
Screenshot Description:
| Windows | | macOS | | Linux | |
|---|
| [Download] | | [Download] | | [Download] | |
Hindi: VS Code download karne ke liye official website code.visualstudio.com par jaayein. Stable Build choose karein – yeh most reliable version hai.
🪟 Install VS Code on Windows
Hindi: Windows mein VS Code install karna bahut easy hai – ek simple installer run karna hai.
Step 1: Run the Installer
Double-click VSCodeUserSetup-x64-*.exe:
┌────────────────────────────────────────────────────────────────┐
│ Visual Studio Code Setup [×] │
├────────────────────────────────────────────────────────────────┤
│ │
│ License Agreement │
│ ───────────────────────────────────────────────────────── │
│ Please read the following important information... │
│ │
│ ○ I accept the agreement ◄── Select this │
│ ○ I do not accept the agreement │
│ │
│ [Back] [Next >] [Cancel] │
│ │
└────────────────────────────────────────────────────────────────┘
Step 2: Choose Installation Location
Default: C:\Users\YourName\AppData\Local\Programs\Microsoft VS Code
Hindi: Default location theek hai – koi change karne ki zaroorat nahi. Next click karein.
Step 3: Select Additional Tasks (IMPORTANT!)
┌────────────────────────────────────────────────────────────────┐
│ Visual Studio Code Setup – Additional Tasks [×] │
├────────────────────────────────────────────────────────────────┤
│ │
│ Select the additional tasks you would like Setup to │
│ perform while installing: │
│ │
│ ☑ Create a desktop icon │
│ │
│ ☑ Add "Open with Code" action to Windows Explorer │
│ file context menu ◄── Very useful! │
│ │
│ ☑ Add "Open with Code" action to Windows Explorer │
│ directory context menu ◄── Very useful! │
│ │
│ ☑ Register Code as an editor for supported file types │
│ │
│ ☑ Add to PATH (requires shell restart) ◄── Important! │
│ │
│ [Back] [Next >] [Cancel] │
└────────────────────────────────────────────────────────────────┘
Hindi: "Add to PATH", "Add Open with Code" dono options zaroor check karein. Yeh bahut useful hote hain.
Step 4: Install & Launch
Click Install and wait for completion. When done, check "Launch Visual Studio Code" and click Finish.
🍎 Install VS Code on macOS
Method 1: Direct Download
1. Download: VSCode-darwin-universal.zip
2. Unzip the file
3. Drag "Visual Studio Code.app" to Applications folder
4. Open from Applications
| VS Code | drag | 📁 Applications | |
|---|
| .app | ──────► | | |
Method 2: Homebrew
brew install --cask visual-studio-code
Add 'code' Command to PATH (macOS)
1. Open VS Code
2. Press Cmd + Shift + P
3. Type: "Shell Command: Install 'code' command in PATH"
4. Press Enter
# Now you can open files from terminal
code myfile.py
code . # Open current folder
Hindi: Mac mein VS Code install karne ke baad code command ko PATH mein add karein taaki terminal se directly files open kar sakein.
🐧 Install VS Code on Linux
Ubuntu / Debian (via .deb)
# Method 1: Download .deb file from website and install
sudo dpkg -i code_*.deb
sudo apt install -f # Fix dependencies if needed
# Method 2: via apt repository (recommended - gets updates automatically)
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt update
sudo apt install code
Fedora / CentOS (via .rpm)
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'
sudo dnf install code
Snap (Universal Linux)
sudo snap install --classic code
🗺️ VS Code Interface Tour
Hindi: VS Code ka interface samajhna bahut important hai. Yahan har part explain kiya gaya hai.
┌──────────────────────────────────────────────────────────────────────┐
│ File Edit Selection View Go Run Terminal Help [× □ –]│
├───┬──────────────────────────────────────────────────────────────────┤
│ │ │
│ A │ B – EDITOR AREA C – MINIMAP │
│ │ ┌────────────────────────────────────┐ ┌───────┐ │
│ C │ │ hello.py × │ test.py │ │ █ █ █ │ │
│ T │ ├────────────────────────────────────┤ │ █ ██ │ │
│ I │ │ 1 │ # My first Python program │ │ █ █ │ │
│ V │ │ 2 │ name = "World" │ └───────┘ │
│ I │ │ 3 │ print(f"Hello, {name}!") │ │
│ T │ │ 4 │ │ │
│ Y │ │ 5 │ │ │
│ │ └────────────────────────────────────┘ │
│ B │ │
│ A │ D – INTEGRATED TERMINAL │
│ R │ ┌────────────────────────────────────┐ │
│ │ │ TERMINAL PROBLEMS OUTPUT DEBUG │ │
│ │ │ > python hello.py │ │
│ │ │ Hello, World! │ │
│ │ └────────────────────────────────────┘ │
├───┴──────────────────────────────────────────────────────────────────┤
│ 🐍 Python 3.13.0 │ UTF-8 │ LF │ Ln 3, Col 28 │ Spaces: 4 │
└──────────────────────────────────────────────────────────────────────┘
A = Activity Bar (left sidebar icons)
B = Editor Area (where you write code)
C = Minimap (code overview)
D = Panel (terminal, problems, output)
Activity Bar Icons:
┌───┐
│ 📁 │ Explorer – View files and folders
├───┤
│ 🔍 │ Search – Find text in files
├───┤
│ 🌿 │ Source Control – Git integration
├───┤
│ 🐛 │ Run & Debug – Debugger
├───┤
│ 🧩 │ Extensions – Install/manage extensions
└───┘
Hindi: VS Code ka interface 5 main parts se bana hai: Activity Bar (left mein icons), Explorer (files dikhata hai), Editor (jahan code likhte hain), Panel (terminal aur output), aur Status Bar (bottom mein info).
🐍 Install Python Extension
The Python extension by Microsoft is the most important extension for Python development in VS Code.
Step 1: Open Extensions Panel
Method 1: Click the Extensions icon in Activity Bar (puzzle piece icon)
Method 2: Press Ctrl + Shift + X (Windows/Linux)
Press Cmd + Shift + X (macOS)
Step 2: Search for Python
| python [Search box] | |
|---|
| 🐍 Python | |
| IntelliSense (Pylance), Linting, Debugging, | |
| code formatting, refactoring... | |
| Microsoft ★★★★★ 52.8M installs | |
| [Install] ◄──────┤ | |
Step 3: Install
Click the Install button next to Python (by Microsoft).
Hindi: Extensions panel mein "python" search karein. Microsoft ki Python extension install karein – 50+ million downloads wali. Yeh automatically Pylance bhi install karti hai.
What Gets Installed Automatically:
Python Extension Pack includes:
✅ Python – Core language support
✅ Pylance – Fast IntelliSense and type checking
✅ Python Debugger – Debug Python programs
After installing the Python extension, tell VS Code which Python to use:
Method 1: Status Bar (Easiest)
| │ 🐍 Select Python Interpreter UTF-8 LF Spaces | 4 │ |
| │ ★ Python 3.13.0 ('base') C | \Python313\python.exe ◄── │ |
| │ Python 3.11.9 64-bit C | \Python311\python.exe │ |
Method 2: Command Palette
1. Press Ctrl + Shift + P
2. Type: "Python: Select Interpreter"
3. Press Enter
4. Choose your Python installation
Method 3: settings.json
// .vscode/settings.json in your project
{
"python.defaultInterpreterPath": "C:\\Python313\\python.exe"
}
Hindi: VS Code ko batana padta hai ki kaunsi Python use karni hai. Bottom status bar mein "Select Python Interpreter" click karein aur apna installed Python version choose karein.
🧩 Essential Python Extensions
Hindi: Python development ke liye kuch aur important extensions hain jo aapki coding life aasaan banate hain.
1. Pylance (Auto-installed)
| Publisher | Microsoft |
| Purpose | Fast IntelliSense, type checking, code analysis |
| Install | Comes with Python extension automatically |
2. Python Indent
| Publisher | Kevin Rose |
| Purpose | Correct Python indentation automatically |
| Install | Search "Python Indent" in Extensions |
3. autoDocstring
| Publisher | Nils Werner |
| Purpose | Auto-generate Python docstrings |
| Install | Search "autoDocstring" |
| Usage | Type """ after a function def, press Enter |
4. GitLens
| Publisher | GitKraken |
| Purpose | Enhanced Git visualization, blame annotations |
| Install | Search "GitLens" |
5. Bracket Pair Colorizer / Rainbow Brackets
| Publisher | OBKoro1 |
| Purpose | Color-code matching brackets |
| Install | Search "Rainbow Brackets" |
6. Error Lens
| Publisher | Alexander |
| Purpose | Show errors/warnings inline in the editor |
| Install | Search "Error Lens" |
7. Jupyter
| Publisher | Microsoft |
| Purpose | Run Jupyter notebooks inside VS Code |
| Install | Search "Jupyter" |
8. Code Runner
| Publisher | Jun Han |
| Purpose | Run code snippets with one click/shortcut |
| Install | Search "Code Runner" |
| Shortcut | Ctrl + Alt + N |
9. Material Icon Theme
| Publisher | Philipp Kief |
| Purpose | Beautiful file icons for better navigation |
| Install | Search "Material Icon Theme" |
10. One Dark Pro / Tokyo Night (Themes)
Purpose: Beautiful dark color themes
Install: Search theme name in Extensions
Install All Essential Extensions at Once (Terminal):
# Open VS Code integrated terminal and run:
code --install-extension ms-python.python
code --install-extension ms-python.pylance
code --install-extension ms-python.debugpy
code --install-extension KevinRose.vsc-python-indent
code --install-extension njpwerner.autodocstring
code --install-extension eamodio.gitlens
code --install-extension usernamehw.errorlens
code --install-extension ms-toolsai.jupyter
code --install-extension PKief.material-icon-theme
⚙️ VS Code Settings for Python
Hindi: Python ke liye VS Code settings configure karna bahut important hai – isse coding experience bahut better ho jaata hai.
Open Settings
| Method 1: File | Preferences → Settings |
| Method 2 | Ctrl + , (Windows/Linux) or Cmd + , (macOS) |
| Method 3: Ctrl + Shift + P | "Open Settings (JSON)" |
Recommended settings.json for Python:
{
// Python specific settings
"python.defaultInterpreterPath": "C:\\Python313\\python.exe",
"python.languageServer": "Pylance",
// Pylance settings
"python.analysis.typeCheckingMode": "basic",
"python.analysis.autoImportCompletions": true,
"python.analysis.completeFunctionParens": true,
// Linting
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.flake8Enabled": false,
// Formatting
"editor.formatOnSave": true,
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true,
"editor.tabSize": 4,
"editor.insertSpaces": true
},
// Editor general
"editor.fontSize": 14,
"editor.fontFamily": "Cascadia Code, Fira Code, Consolas, monospace",
"editor.fontLigatures": true,
"editor.lineHeight": 22,
"editor.wordWrap": "on",
"editor.minimap.enabled": true,
"editor.renderWhitespace": "boundary",
"editor.rulers": [79, 120],
// Terminal
"terminal.integrated.fontSize": 13,
"terminal.integrated.defaultProfile.windows": "Command Prompt",
// Files
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 1000,
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
// Theme
"workbench.colorTheme": "One Dark Pro",
"workbench.iconTheme": "material-icon-theme"
}
Hindi: Yeh settings Python coding ke liye optimized hain. editor.formatOnSave code ko save karte waqt automatically format karta hai. editor.rulers line length limit dikhata hai (PEP8 standard: 79 characters).
💻 Using the Integrated Terminal
Hindi: VS Code ka integrated terminal bahut powerful hai – aapko alag Command Prompt/Terminal khol ke Python run karne ki zaroorat nahi.
Open Terminal
| Method 1: View | Terminal (from menu) |
| Method 2 | Ctrl + ` (backtick key) (Windows/Linux) |
| Method 3: Terminal | New Terminal (from menu) |
Terminal Commands for Python:
# Run a Python file
python hello.py
# Run Python interactively
python
# Install a package
pip install requests
# Run with specific Python version
python3.13 hello.py
# Create virtual environment
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# Mac/Linux:
source venv/bin/activate
# Check Python version
python --version
# List installed packages
pip list
Running Python from Editor:
| Method 1: Right-click in editor | "Run Python File in Terminal" |
| Method 2 | Click the ▶ Play button (top right of editor) |
| Method 3: Ctrl + Shift + P | "Python: Run Python File in Terminal" |
| Method 4 | Ctrl + Alt + N (with Code Runner extension) |
⌨️ Keyboard Shortcuts
Hindi: Yeh keyboard shortcuts yaad karein – coding speed bahut badh jaayegi!
Essential Shortcuts:
| Action | Windows/Linux | macOS |
|---|
| Open Command Palette | Ctrl+Shift+P | Cmd+Shift+P |
| Open/Close Terminal | Ctrl+\` | Cmd+\` |
| Save file | Ctrl+S | Cmd+S |
| Save all | Ctrl+K S | Cmd+K S |
| Run Python file | F5 | F5 |
| Find in file | Ctrl+F | Cmd+F |
| Find in all files | Ctrl+Shift+F | Cmd+Shift+F |
| Go to line | Ctrl+G | Cmd+G |
| Toggle comment | Ctrl+/ | Cmd+/ |
| Format document | Shift+Alt+F | Shift+Option+F |
| Indent line | Tab | Tab |
| Multi-cursor | Ctrl+Alt+↓ | Cmd+Option+↓ |
| Duplicate line | Shift+Alt+↓ | Shift+Option+↓ |
| Delete line | Ctrl+Shift+K | Cmd+Shift+K |
| Move line up/down | Alt+↑/↓ | Option+↑/↓ |
| Quick open file | Ctrl+P | Cmd+P |
| Zen mode | Ctrl+K Z | Cmd+K Z |
| Extensions | Ctrl+Shift+X | Cmd+Shift+X |
| IntelliSense | Ctrl+Space | Ctrl+Space |
Hindi: Ctrl+S (save), Ctrl+/ (comment toggle), F5 (run) – yeh teen shortcuts sabse important hain. Inhe pehle yaad karein.
🐛 Using the Python Debugger
Hindi: Debugger se aap code ko step by step run kar sakte hain aur dekh sakte hain ki variables mein kya value hai.
Set a Breakpoint:
Click in the left gutter (line number area) of any line
A red dot (●) appears = breakpoint set
Start Debugging:
| Method 1 | Press F5 |
| Method 2: Run | Start Debugging |
| Method 3 | Click the ▶ button in Debug panel |
Debug Controls:
┌─────────────────────────────────────────────────────────┐
│ DEBUG TOOLBAR │
│ │
│ ▶ Continue (F5) – Run until next breakpoint │
│ ⤵ Step Over (F10) – Execute current line │
│ ⤴ Step Into (F11) – Enter function call │
│ ⤳ Step Out (F12) – Exit current function │
│ ↺ Restart (Ctrl+Shift+F5) – Restart debugging │
│ ■ Stop (Shift+F5) – Stop debugging │
└─────────────────────────────────────────────────────────┘
Example Debug Session:
# debug_example.py
def calculate_total(prices):
total = 0 # ← Set breakpoint here
for price in prices:
total += price
return total
items = [10.99, 25.50, 8.75, 15.00]
result = calculate_total(items)
print(f"Total: ${result:.2f}")
# In Debug Console, hover over 'total' to see its value
# In Variables panel:
# total = 0
# price = 10.99 (first iteration)
# items = [10.99, 25.50, 8.75, 15.00]
🔧 Troubleshooting
❌ Problem 1: "Python is not installed" error in VS Code
Hindi: VS Code ko Python nahi mil raha toh yeh karo:
Fix:
1. Open Command Palette (Ctrl+Shift+P)
2. Type "Python: Select Interpreter"
3. Select the correct Python path
4. If not shown, click "Enter interpreter path"
5. Navigate to python.exe and select it
❌ Problem 2: IntelliSense (autocomplete) not working
Fix:
| 2. Ctrl+Shift+P | "Python: Select Interpreter" → choose Python |
| 3. Reload VS Code: Ctrl+Shift+P | "Developer: Reload Window" |
| "python.languageServer" | "Pylance" |
❌ Problem 3: Code won't run – "python: command not found"
Fix:
# In VS Code terminal, check if Python is found
where python # Windows
which python3 # Mac/Linux
# If not found, Python PATH issue
# See install-python.mdx → PATH setup section
❌ Problem 4: Linting errors showing for correct code
Hindi: Agar correct code mein bhi errors dikhein toh linter ki settings check karein.
Fix:
// settings.json – disable if causing issues
{
"python.linting.enabled": false
}
// OR install the specific linter:
// pip install pylint OR pip install flake8
❌ Problem 5: VS Code is running slowly
Fix:
1. Disable unused extensions
2. Reduce file watcher: "files.watcherExclude": {"**/node_modules/**": true}
3. Disable minimap: "editor.minimap.enabled": false
4. Reduce auto-save delay
5. Restart VS Code
❌ Problem 6: Terminal won't open in VS Code
Fix:
| 1. View | Terminal menu option |
| 2. Or: Ctrl+Shift+P | "Terminal: Create New Terminal" |
| Terminal | Select Default Profile → Command Prompt |
📊 VS Code Setup Checklist
┌─────────────────────────────────────────────────────────────┐
│ VS CODE PYTHON SETUP CHECKLIST │
├─────────────────────────────────────────────────────────────┤
│ │
│ Installation │
│ ☐ VS Code downloaded from code.visualstudio.com │
│ ☐ VS Code installed with "Add to PATH" checked │
│ │
│ Extensions │
│ ☐ Python extension (Microsoft) installed │
│ ☐ Pylance installed (auto with Python ext) │
│ ☐ Python Debugger installed │
│ │
│ Configuration │
│ ☐ Python interpreter selected │
│ ☐ settings.json configured for Python │
│ ☐ Format on save enabled │
│ │
│ Testing │
│ ☐ Opened a .py file successfully │
│ ☐ IntelliSense working (auto-complete appears) │
│ ☐ Ran Python file from terminal │
│ ☐ Debugger tested with a breakpoint │
│ │
└─────────────────────────────────────────────────────────────┘
🚀 Summary
VS Code is now configured for Python development!
✅ VS Code installed
✅ Python extension installed
✅ Pylance language server active
✅ Python interpreter configured
✅ Integrated terminal ready
✅ Debugger available
Hindi: VS Code ab Python ke liye bilkul ready hai. Agle step mein Python IDLE ke baare mein seekhein, aur phir apna pehla Python program likhein!
Next Steps:
| Step | Topic | File |
|---|
| ← Previous | Install Python | install-python.mdx |
| → Next | Python IDLE | python-idle.mdx |
| → Later | First Python Program | first-python-program.mdx |
*Last Updated: June 12, 2026 | Author: WohoTech | Category: Python Setup*