① Step 1 Introduction
✅
💙 VS Code Setup

Visual Studio Code + Python + Jupyter

Set up the world's most popular code editor with the extensions that make Python development fast, intelligent, and productive.

💙

VS Code

Free, open-source editor by Microsoft. Lightweight yet powerful — extensible to a full IDE via extensions.

🐍

Python Extension

IntelliSense, linting, debugging, code navigation, formatting — transforms VS Code into a professional Python IDE.

📓

Jupyter Extension

Run Jupyter notebooks (.ipynb) directly inside VS Code without a separate browser window.

🎨

Bonus Extensions

Pylance, Ruff, GitLens, Rainbow CSV and more to supercharge your workflow.

ℹ️
PrerequisitesPython must already be installed on your system. If not, complete the Python Setup guide first before continuing here.

Select your operating system:

🪟
Windows
10 or 11
🍎
macOS
Monterey or later
🐧
Linux
Ubuntu / Debian
⬇️ Step 1

Download VS Code

Get the installer from the official Microsoft website. Always use code.visualstudio.com.

✅
Free & Open SourceVS Code is completely free. Current stable release is updated monthly.
1
Go to code.visualstudio.com
The website auto-detects Windows and shows the blue "Download for Windows" button.
2
Click "Download for Windows"
Downloads VSCodeUserSetup-x64-x.xx.x.exe (~100 MB). The "User Installer" is recommended — no admin rights needed.
3
Alternatively — install via winget
>winget install Microsoft.VisualStudioCode
1
Option A — Direct download
Go to code.visualstudio.com, click "Download for Mac". Downloads a .zip file — extract it and drag VS Code to Applications.
2
Option B — Homebrew (Recommended)
$brew install --cask visual-studio-code
$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 apt update && sudo apt install code -y
$sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
$sudo dnf install code -y
$sudo snap install --classic code
💾 Step 2

Install & First Launch

Run the installer, configure key options, and understand the VS Code interface.

1
Double-click the .exe installer
Accept the license. On the "Select Additional Tasks" screen, check these options:
☑️
Recommended checkboxes to enable:
  • Add "Open with Code" action to Windows Explorer file context menu
  • Add "Open with Code" action to Windows Explorer directory context menu
  • Register Code as an editor for supported file types
  • Add to PATH (so you can type code . in any terminal)
2
Click "Install" then "Finish"
VS Code launches automatically. Restart your terminal to use the code command.
1
Extract and move to Applications
Unzip the downloaded file, then drag Visual Studio Code.app into your /Applications folder. If you used Homebrew, skip this — already done.
2
Enable the code CLI command
Open VS Code → press Cmd+Shift+P → type "Shell Command" → click "Shell Command: Install 'code' command in PATH".
✅
Already done!The package manager command installed and registered VS Code. The code command is already in your PATH.
💡
Launch with: code . from any project directory, or find VS Code in your applications menu.

VS Code Interface — Know Your Way Around

Visual Studio Code — my-project
📁
🔍
🧩
🌿
🐛
Explorer
📁 my-project
🐍 main.py
📓 notebook.ipynb
📄 requirements.txt
📁 .venv
1# main.py — click sidebar icons to explore →
2import numpy as np
3
4def greet(name):
5 print(f"Hello, {name}!")
6
7greet("Python")

← Click the sidebar icons above to explore each panel

🐍 Step 3

Install the Python Extension

The official Python extension by Microsoft turns VS Code into a full Python IDE with IntelliSense, debugging, and more.

Install via Extensions Marketplace (simulated):

3 ways to install:

A
Via Extensions Panel (easiest)
Press Ctrl+Shift+X (Windows/Linux) or Cmd+Shift+X (Mac) → search Python → click Install on the Microsoft result.
B
Via Command Palette
Press Ctrl+Shift+P → type ext install ms-python.python → press Enter.
C
Via Terminal (CLI)
$code --install-extension ms-python.python

What the Python extension adds to VS Code:

🧠 IntelliSense

Auto-complete for Python keywords, functions, variables, and imported modules. Hover docs show docstrings inline.

🐛 Debugger

Set breakpoints, step through code, inspect variables — all inside VS Code. No separate debugger needed.

🏝 Virtual Envs

Detects and activates virtual environments automatically. Switch interpreters from the status bar.

✅ Test Runner

Run pytest or unittest tests directly in VS Code. See pass/fail inline next to each test function.

✅
Verify installationOpen any .py file — you should see the Python version in the bottom status bar (e.g., Python 3.12.4). If not, click the status bar to select an interpreter.
📓 Step 4

Install the Jupyter Extension

Run Jupyter notebooks (.ipynb files) directly inside VS Code — no browser, no separate server.

1
Open Extensions Marketplace
Press Ctrl+Shift+X (Windows/Linux) or Cmd+Shift+X (Mac)
2
Search for "Jupyter"
Find Jupyter by Microsoft (90M+ downloads). Click Install.
3
Or install via terminal
$code --install-extension ms-toolsai.jupyter
4
Install ipykernel (required for notebooks)
Activate your virtual environment, then:
$pip install ipykernel

Create your first notebook in VS Code:

1
Create a new notebook
Press Ctrl+Shift+P → type Jupyter: Create New Blank Notebook → press Enter. Or create a new file and name it with a .ipynb extension.
2
Select a kernel
Click "Select Kernel" in the top-right corner of the notebook → choose "Python Environments" → select your Python interpreter or venv.
3
Run a cell
Click the ▶ Run button on a cell, or press Shift+Enter to run and move to next cell.

Simulated Jupyter cell inside VS Code:

notebook.ipynb — Kernel: Python 3.12
[1]
import pandas as pd
import matplotlib.pyplot as plt
df = pd.DataFrame({'x': [1,2,3], 'y': [4,8,6]})
print(df)

← Click ▶ to simulate running the notebook cell

🎨 Step 5

Bonus Extensions

These extensions take your Python development from good to exceptional. Install the ones relevant to your workflow.

🎨
Pylance
Microsoft
Supercharged Python language server. Provides faster, more accurate IntelliSense, type checking, and import sorting. Pairs with the Python extension.
Type CheckingFast IntelliSenseImport Sorting
ms-python.vscode-pylance
⚡
Ruff
Astral Software
Ultra-fast Python linter and formatter — 10-100x faster than flake8 or black. One extension replaces flake8, isort, pyupgrade, and more.
LintingFormattingFast
charliermarsh.ruff
🌿
GitLens
GitKraken
See who wrote every line of code (git blame), explore commit history, compare branches — all without leaving VS Code.
Git BlameHistoryDiff
eamodio.gitlens
🌈
Rainbow CSV
mechatroner
Highlights CSV/TSV columns in different colors. Makes data files readable at a glance. Essential for data science work.
CSVData ScienceHighlighting
mechatroner.rainbow-csv
🐳
Docker
Microsoft
Build, manage, and deploy Docker containers from VS Code. Essential once your projects grow beyond local development.
DockerContainersDevOps
ms-azuretools.vscode-docker
⚡
Install all essential extensions at once:
$code --install-extension ms-python.python ms-toolsai.jupyter ms-python.vscode-pylance charliermarsh.ruff
⚡ Step 6

Run Your First Python File

Create a project, link your virtual environment, write code, and run it — all inside VS Code.

1
Open a folder as a project
In Command Prompt:
>mkdir hello-python && cd hello-python && code .
In Terminal:
$mkdir hello-python && cd hello-python && code .
2
Select a Python Interpreter
Press Ctrl+Shift+P (or Cmd+Shift+P) → type Python: Select Interpreter → choose your Python version or virtual environment. You'll see it in the status bar at the bottom.
💡
To use a virtual environment, create it first: python -m venv .venv, then select .venv as your interpreter in VS Code.
3
Create hello.py
Press Ctrl+N (new file), paste this code, save as hello.py:
hello.py
1# Your first Python file in VS Code
2def main():
3 name = input("Enter your name: ")
4 print(f"Hello, {name}! VS Code is ready 🚀")
5
6if __name__ == "__main__":
7 main()
4
Run the file
3 ways to run:
  • Click the ▶ Run button in the top-right corner
  • Right-click in editor → "Run Python File in Terminal"
  • Press Ctrl+F5 (run without debugger) or F5 (run with debugger)
🎉
VS Code is fully set up!You can now write Python with IntelliSense, run Jupyter notebooks, debug, lint, and format — all in one tool.
🔧 Troubleshooting

Common Issues & Fixes

Click any error to expand the diagnosis and solution.

🚨 Python extension not showing interpreter / "No Python interpreter selected" ▼
Cause: Python extension can't find a Python installation, or you need to manually select one.
Fix: Press Ctrl+Shift+P → Python: Select Interpreter → choose your Python from the list. If empty, ensure Python is installed and in your PATH.
🚨 Jupyter: "No kernel found" or "Failed to start kernel" ▼
Cause: ipykernel is not installed in the selected Python environment.
$pip install ipykernel --upgrade
Make sure your venv is activated when running this. Then reload VS Code window: Ctrl+Shift+P → "Reload Window".
🚨 'code' is not recognized as a command in terminal ▼
Cause (Windows): "Add to PATH" was not checked during installation, or terminal hasn't been restarted.
Fix Windows: Reinstall VS Code with PATH option, or add C:\Users\{user}\AppData\Local\Programs\Microsoft VS Code\bin to PATH manually.
Fix macOS: Open VS Code → Cmd+Shift+P → "Shell Command: Install 'code' command in PATH".
🚨 IntelliSense / autocomplete not working ▼
Causes: Wrong interpreter selected, Pylance not installed, or extension needs restart.
Steps:
  1. Verify correct interpreter selected (status bar, bottom-left)
  2. Install Pylance: code --install-extension ms-python.vscode-pylance
  3. Reload VS Code: Ctrl+Shift+P → "Reload Window"
🚨 Linting errors everywhere after installing Ruff ▼
Cause: Ruff is working correctly — it's showing real issues. But if you get too many warnings, you can configure it.
Create a pyproject.toml or ruff.toml in your project root:
pyproject.toml
[tool.ruff]
line-length = 88
ignore = ["E501"]
# See ruff.readthedocs.io for all options
🚨 VS Code is very slow / high memory usage ▼
Cause: Too many extensions, large workspaces, or type checking on large codebases.
  • Disable unused extensions for the workspace
  • Set Pylance type checking to "basic" instead of "strict"
  • Exclude large folders from file watching in settings: files.watcherExclude
  • Use Ctrl+Shift+P → "Process Explorer" to see which extension is using the most memory
🏁 Summary

Tips, Shortcuts & Summary

Master your VS Code workflow with essential shortcuts and power-user tips.

✅ Setup Checklist

✓
VS Code downloaded and installed
✓
code . command works in terminal
✓
Python extension (ms-python.python) installed
✓
Jupyter extension (ms-toolsai.jupyter) installed
✓
Python interpreter selected in VS Code status bar
✓
Successfully ran a .py file in VS Code terminal
✓
Created and ran a Jupyter notebook cell

⌨️ Essential Shortcuts

Action Windows / Linux macOS
Command PaletteCtrl+Shift+PCmd+Shift+P
Open ExtensionsCtrl+Shift+XCmd+Shift+X
Open TerminalCtrl+`Ctrl+`
Run Python fileCtrl+F5Ctrl+F5
Debug Python fileF5F5
Jupyter: Run cellShift+EnterShift+Enter
Quick file openCtrl+PCmd+P
Select interpreterCtrl+Shift+P → Python: Select Interpreter
Format documentShift+Alt+FShift+Option+F
Go to definitionF12F12
Peek definitionAlt+F12Option+F12
Multi-cursorAlt+ClickOption+Click

💡 Power User Tips

⚙️
Workspace Settings
Store project-specific settings in .vscode/settings.json. Commit to Git so your team gets the same setup.
🏝
Auto-activate venv
Add "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python" to .vscode/settings.json so VS Code always uses your project venv.
🔄
Format on Save
Set "editor.formatOnSave": true in settings to automatically run Ruff/Black whenever you save a file.
🔗
Profile Sync
Sign in to VS Code with GitHub to sync your settings, extensions, and keybindings across all your machines.
💙

VS Code is Ready!

Python extension ✓ · Jupyter extension ✓ · Ready to code.