Skip to content

Visual Studio Code Install and Setup

Install Visual Studio Code (VS Code), add the extensions you need for Python, and apply a few settings that make learning easier.

Step-01: What You Will Learn

Setup: what we will do in VS Code. Three things, in this order, and then you are ready to write Python. One, install VS Code: download it, install it, and open it until the Welcome tab appears, using code.visualstudio.com, then the .dmg or the Windows installer, then the Welcome tab. This step differs by operating system. Two, add four extensions for Python support, a fast linter, a dark theme and clear file icons: Python, Ruff, One Dark Pro and Material Icon Theme. Same on every operating system. Three, change three settings for roomier folder indents, line wrapping and auto save, so you never lose a change: tree indent, word wrap and auto save. Same settings, only the keys differ. Do this once now, and the editor stays set up for the whole course

In this lesson you will:

  • Install VS Code on your operating system (macOS, Windows, or Linux).
  • Install the Python extensions and a few helpful add-ons (a theme, file icons, and Ruff).
  • Turn on the color theme and file icons.
  • Apply the VS Code settings we use throughout the course.

Step-02: Install VS Code

Setup: install VS Code, the editor you will write every line of this course in. Install it once. macOS, and Linux is similar: 1 download from code.visualstudio.com; 2 open the .dmg and drag Visual Studio Code into Applications; 3 launch it by pressing Cmd plus Space, typing Visual Studio Code and pressing Enter. You are done when the Welcome tab opens. Windows, where the installer does more: 1 download from code.visualstudio.com; 2 run the installer and tick Add to PATH and both Open with Code options; 3 launch it from the Start menu. You are done when the Welcome tab opens

Do the step for your operating system. The extension and settings steps later are the same on every OS.

  1. Download VS Code from code.visualstudio.com.
  2. Double-click the downloaded file (example: VSCode-darwin-universal.dmg).
  3. Drag Visual Studio Code into the Applications folder.
  4. Press Cmd + Space to open Spotlight, type Visual Studio Code, and press Enter to open it.
  5. You should see the Welcome tab.
  6. For more help, see the official macOS install guide.
  1. Download VS Code from code.visualstudio.com.
  2. Double-click the downloaded file to start the installer.
  3. During installation, make sure these options are checked:
  4. Add "Open with Code" to the Windows Explorer file context menu
  5. Add "Open with Code" to the Windows Explorer directory context menu
  6. Register Code as an editor for supported file types
  7. Add to PATH
  8. Open Visual Studio Code and confirm it starts.
  9. You should see the Welcome tab.
  10. For more help, see the official Windows install guide.
  1. VS Code is available for most Linux distributions (Debian/Ubuntu .deb, Red Hat/Fedora .rpm, and Snap).
  2. Follow the official Linux install guide for your distribution.

Step-03: Install the VS Code Extensions

Setup: install the VS Code extensions. Use the Extensions icon in the left sidebar, search the name, click Install, and check the publisher. Install these four yourself: Python by Microsoft, to run and debug code, pick your interpreter and autocomplete, the must-have one; Ruff by Astral Software, a very fast linter that underlines mistakes as you type; One Dark Pro by binaryify, a clean dark colour theme that is comfortable to read; and Material Icon Theme by Philipp Kief, coloured icons per file type so you spot a .py at a glance. Python brings these along: Pylance, the engine behind autocomplete, type hints and go to definition; Python Debugger, to set breakpoints and step through your code to find bugs; and Python Environments, to create and manage virtual environments and packages from the UI. You do not install those three, they arrive with the Python extension. The Command Palette, which is how you run any command in VS Code, is Cmd plus Shift plus P on macOS and Ctrl plus Shift plus P on Windows. Then turn them on: installing does not switch them on, so open the Command Palette and pick Preferences Color Theme and Preferences File Icon Theme

Extensions add features to VS Code. To install one, click the Extensions icon in the left sidebar, search for the extension by name, and click Install.

Tip: Always check the publisher before installing, so you get the official extension. For example, Python should be built by Microsoft.

Install these four extensions:

S.No Extension Built by Why we install it
1 Python Microsoft Core Python support: run and debug code, pick your Python interpreter, and get autocomplete and error checking. The must-have extension.
2 One Dark Pro binaryify A clean, popular dark color theme that is comfortable to read.
3 Material Icon Theme Philipp Kief Clear, colored icons per file type, so you can tell .py, .md, .yaml, and folders apart at a glance.
4 Ruff Astral Software A very fast Python linter and formatter. It underlines mistakes as you type and can tidy your code formatting.

When you install the Python extension, it brings these along automatically:

S.No Bundled with Python What it does
1 Pylance The engine behind autocomplete, type hints, and go-to-definition.
2 Python Debugger Set breakpoints and step through your code to find bugs.
3 Python Environments Create and manage virtual environments and packages from the UI.

After installing, turn on the theme and icons. Installing them does not switch them on. You select them through the Command Palette, which is how you run any command in VS Code.

  • Color theme: press Cmd + Shift + P (macOS) or Ctrl + Shift + P (Windows/Linux), type Color Theme, select Preferences: Color Theme, then choose One Dark Pro Darker (or One Dark Pro for the lighter default).
  • File icons: press Cmd + Shift + P (or Ctrl + Shift + P), type File Icon Theme, select Preferences: File Icon Theme, then choose Material Icon Theme.

Note: Ruff starts checking your code as soon as it is installed, so you will see underlines on mistakes right away. We will turn on automatic formatting in a later lesson.

Step-04: Update Important VS Code Settings

Setup: update important VS Code settings. Only the key to open Settings differs, and the three changes are the same everywhere. On macOS, and Linux is similar, Cmd plus comma opens Settings. On Windows, Ctrl plus comma opens Settings. Then type each one in the search box and set the value. Search for tree indent and set it to 20, for more space between nested folders so the project is easy to read. Search for word wrap and set it to on, so long lines wrap instead of scrolling off the right edge. Search for auto save and set it to afterDelay: it is off by default, so this one really matters, and it saves your file one second after you stop typing

Open Settings with Cmd + , (macOS) or Ctrl + , (Windows/Linux). For each row below, type the search text in the settings search box, then set the value shown.

S.No Search for Set it to Why we need it
1 tree indent 20 More space between nested folders in the sidebar, so the project structure is easy to read.
2 word wrap on Long lines wrap onto the next line instead of scrolling off the right edge, so you never miss code.
3 auto save afterDelay Saves your file automatically one second after you stop typing, so you never lose changes or forget to save.

Note: Auto Save is off by default, so this one really does need changing. Leave the Auto Save Delay at its default (1000 ms).

🎉 New Course
Python for Absolute Beginners
$15.99 $84.99 81% OFF
Get the Video Course