Article · 15 SEPT 2026 · 4 min · Hariom Lohar

Setup VS Code for Python

A step-by-step guide to installing VS Code and setting it up to write and run Python code smoothly.

By Hariom Lohar (hariomlohardev) · 768 words · committed in public

Once Python is installed on your PC, the next step is picking a good place to actually write your code. That's where VS Code comes in — it's free, lightweight, and used by beginners and professionals alike.

This guide will walk you through installing VS Code and setting it up properly for Python.


✅ Before You Start

Make sure you've already installed Python on your PC. If you haven't done that yet, go back and follow the Install Python on Windows guide first — VS Code needs Python already installed to work with it.


Step 1: Download VS Code

Head over to the official website and download the installer for Windows:

🔗 Download VS Code


Step 2: Run the Installer

Open the downloaded file and go through the setup. On the way, you'll see a few checkboxes — make sure these are ticked:

  • ☑️ Add "Open with Code" action to Windows Explorer file context menu
  • ☑️ Add "Open with Code" action to Windows Explorer directory context menu
  • ☑️ Add to PATH

These make VS Code much easier to open later, right from any folder. Then click Install and wait for it to finish.


Step 3: Open VS Code

Once installed, open VS Code. You'll see a clean welcome screen — this is your new coding home base.


Step 4: Install the Python Extension

VS Code is a general-purpose editor by default, so we need to add Python support to it:

  • On the left sidebar, click the Extensions icon (it looks like four squares)
  • Search for "Python"
  • Look for the official extension published by Microsoft
  • Click Install

This adds things like code suggestions, error checking, and the ability to run Python files directly.


Step 5: Make Sure VS Code Can Find Python

  • Press Ctrl + Shift + P to open the Command Palette
  • Type "Python: Select Interpreter" and press Enter
  • Choose the Python version that shows up in the list (it should match the version you installed earlier)

This tells VS Code exactly which Python installation to use when running your code.


Step 6: Write and Run Your First Program

  • Go to File > New File, and save it as hello.py
  • Type:
print("Hello, World!")
  • Run it in one of two ways:
  • Click the ▶ Run button in the top-right corner, or
  • Right-click anywhere in the file and choose "Run Python File in Terminal"

You'll see the output appear in the integrated terminal at the bottom of the screen:

Hello, World!

🎁 Bonus: Handy Extensions and Tips

  • Pylance — usually installs automatically with the Python extension, and gives you smarter code suggestions
  • Auto-formatting — VS Code can automatically indent and clean up your code as you type
  • Integrated Terminal — open it anytime with Ctrl + ` (backtick) to run Python commands without leaving the editor

🛠️ Common Problems & Fixes

"code" is not recognized in Command Prompt
This means "Add to PATH" wasn't checked during install. Reinstall VS Code and make sure that option is ticked, or add it manually via Windows Environment Variables.

Run button doesn't show up / errors about no interpreter
This usually means Python wasn't detected. Go back to Step 5 and manually select your Python interpreter.

Code runs but says "python is not recognized"
This is usually a Python PATH issue, not a VS Code issue — revisit the Python installation guide and make sure "Add python.exe to PATH" was checked when installing Python.


❓ Frequently Asked Questions

Is VS Code free?
Yes, completely free and works on Windows, Mac, and Linux.

Do I need the Python extension specifically?
Yes — without it, VS Code won't understand or run Python files properly.

Can I use VS Code without installing Python separately?
No, VS Code is just the editor — you still need Python installed on your system for it to actually run your code.

Is VS Code the same as PyCharm or other IDEs?
Not exactly — VS Code is lighter and more general-purpose, while tools like PyCharm are built specifically for Python. VS Code is a great, simple starting point.


🚀 You're Ready!

You now have a proper coding setup — Python installed, and VS Code ready to write, run, and debug your programs. From here on, all your practice code can live right here.

Stuck at any step? Ask away in the group:

💬 WhatsApp Group (Learn Python)

Rate this log tap a star · smooth
thanks for rating
Discuss — replies · rating 0 comments
cookie hl_cid · name saved after first comment
Share — Lab Notebook №01
← Back to blog Follow on GitHub ↗