Computer courses · Tools for technicians · Tech support Call 859-878-2615 WhatsApp Send a message

Home · Blog

Step-by-step guide

How to install Visual Studio Code on Windows and set it up for Python

By Gabriel ·

Short answer: to install Visual Studio Code on Windows, download the free installer from code.visualstudio.com, accept the license, tick Add to PATH (and a desktop icon if you want one) and click Install. Then open the Extensions view with Ctrl+Shift+X, search for Python and install Microsoft's extension. After that you can create a new Python file and start typing code.

VS Code is a text editor for many programming languages, and for Python it is a great place to start: it helps you find errors quicker and completes code as you type. In this lesson from my 2021 Python course I install it on Windows, add the Python extension and type a first print() line. Below you get each step with a screenshot, plus the part beginners often miss: VS Code and its extension do not include Python itself, so you also need a Python interpreter to run what you write.

DifficultyVery easy
Time10-15 minutes
Tools & requirementsA Windows PC with an internet connection (the video uses Windows with Firefox), The free Visual Studio Code installer from code.visualstudio.com (User setup for Windows), Microsoft's Python extension for VS Code (installed from inside the editor), A Python 3 interpreter to actually run your code (python.org or the Microsoft Store; already installed on the PC in the video), No administrator rights needed for the User setup
In this article
  1. Go to the Visual Studio Code website
  2. Pick the Windows download (or another system)
  3. Run the installer and accept the agreement
  4. Tick Add to PATH and Create a desktop icon
  5. Click Install and launch VS Code
  6. Open the Extensions view (Ctrl+Shift+X) and search for Python
  7. Install Microsoft's Python extension
  8. Open a folder or start a new file
  9. Choose Python as the language of the new file
  10. Type your first line: print()
  11. Let VS Code close parentheses and quotes for you
  12. Save the file
  13. Use the Edit menu: undo, redo, copy, paste, find
  14. Install the Python interpreter (VS Code doesn't include it)
  15. Run your first Python file in VS Code
  16. User setup vs System setup vs ZIP: which VS Code installer?
  17. Troubleshooting a VS Code install on Windows
  18. Useful VS Code shortcuts for Python beginners
  19. What to do next
  20. Frequently asked questions
  21. Watch the video

Step 1Go to the Visual Studio Code website

The Visual Studio Code home page at code.visualstudio.com in a web browser on Windows, with the headline Code editing Redefined and a blue Download for Windows button for the free stable build
  • Open your browser and go to code.visualstudio.com, or simply search for Visual Studio Code.
  • The site detects your system and shows a Download for Windows button. VS Code is free and built on open source.
  • Common mistake: downloading Visual Studio (the big IDE) instead of Visual Studio Code. They are different products; for this course you want the lightweight editor.

Note: Only download from the official site. Third-party download pages sometimes bundle unwanted software.

Step 2Pick the Windows download (or another system)

Visual Studio Code download drop-down menu open on the website, listing macOS Universal, Windows x64 User Installer and Linux x64 packages with stable and insiders builds
  • Click the small arrow next to the download button to see other operating systems: macOS, Windows and Linux builds.
  • For this guide choose Windows. The download is the User Installer (VSCodeUserSetup-{version}.exe).
  • Pick the Stable build. Insiders is a preview version with daily changes, not what a beginner needs.
  • Tip: if you already downloaded it before (like I had in the video), just open the file from your Downloads folder.

Step 3Run the installer and accept the agreement

Setup Microsoft Visual Studio Code User installer window on Windows showing the License Agreement page with the Microsoft software license terms and the I accept the agreement option
  • Double-click the installer. The window title says Setup - Microsoft Visual Studio Code (User).
  • Select I accept the agreement and click Next.
  • On the next pages you can keep the default folder and Start Menu folder and just click Next.
  • Why User setup: Microsoft recommends it for most people because it does not need administrator rights and updates smoothly in the background.

Step 4Tick Add to PATH and Create a desktop icon

VS Code Windows setup Select Additional Tasks page with Create a desktop icon checked and Add to PATH requires shell restart checked, and the mouse on the Next button
  • On Select Additional Tasks, make sure Add to PATH (requires shell restart) is checked. This lets you open VS Code by typing code in a terminal.
  • Also tick Create a desktop icon so you have it on your desktop ready to use.
  • The "Open with Code" options for the right-click menu are optional; they are handy for opening a project folder from File Explorer.
  • Common mistake: leaving Add to PATH unchecked and later getting "'code' is not recognized" in the terminal.

Note: "Requires shell restart" means any Command Prompt or PowerShell window that was already open will not see the change. Close it and open a new one after installing.

Step 5Click Install and launch VS Code

Visual Studio Code Windows installer on the Installing page with a green progress bar while it extracts files into the AppData Local Programs Microsoft VS Code folder
  • Click Install and wait for the progress bar. It only takes a moment on most PCs.
  • The User setup installs into C:\Users\{your-name}\AppData\Local\Programs\Microsoft VS Code, so it doesn't touch other users on the computer.
  • At the end leave Launch Visual Studio Code checked and click Finish.
  • Tip: to confirm the PATH setting worked, open a new terminal and run code --version.

Step 6Open the Extensions view (Ctrl+Shift+X) and search for Python

Visual Studio Code Extensions view on Windows with python typed in the marketplace search box, listing Pylance and the Microsoft Python extension with IntelliSense, linting and debugging
  • VS Code is just a text editor for many languages; extensions add support for each one. For Python you need the Python extension.
  • Click the Extensions icon in the left bar. If you hover over it, it shows the shortcut Ctrl+Shift+X, which opens the same view.
  • Type python in the search box at the top.
  • Common mistake: installing a random extension with "Python" in its name. Look for the one published by Microsoft.

Step 7Install Microsoft's Python extension

Python extension for Visual Studio Code page by Microsoft in the VS Code marketplace view, with the blue install button and the description of IntelliSense, linting and debugging support
  • Select Python by Microsoft and click Install. (In the video it shows as already installed because I had used it for another lesson.)
  • The extension adds Python IntelliSense (smart completion), linting, running and debugging.
  • Today it also installs helper extensions automatically, such as Pylance and the Python Debugger. You don't need to install those one by one.
  • No restart is needed; the extension is active right away.

Step 8Open a folder or start a new file

VS Code Explorer side bar with the message You have not yet opened a folder, a blue Open Folder button and a Clone Repository button, on Windows with Visual Studio Code freshly installed
  • Click the Explorer icon (top of the left bar). If you already have Python files, click Open Folder and pick the folder that contains them.
  • If you want to start new, create a new file instead (on the Welcome page, or File > New File / New Text File).
  • Why a folder helps: when you open a folder, VS Code treats it as your workspace, and all your course exercises stay together.
  • Tip: make one folder per course or project, for example Documents\python-course.

Step 9Choose Python as the language of the new file

Visual Studio Code Select Language Mode list open on a new untitled file, showing languages such as Batch, C, C#, C++ and CSS, where you type python to pick the Python language
  • A new file starts as plain text. Click Select a language (or the language name in the bottom-right status bar).
  • Type python and pick the first result, Python.
  • Now VS Code knows it's Python code, so the extension can color it, complete it and check it.
  • Common mistake: typing code in a plain-text file. You won't get any suggestions until the language is Python (or the file is saved with a .py name).

Step 10Type your first line: print()

VS Code editor with a Python print function being typed and the IntelliSense tooltip explaining print parameters value, sep, end, file and flush, showing how the Python extension helps beginners
  • Type print. As soon as you start, VS Code suggests the function and shows a tooltip with its parameters and what it does.
  • Open the parenthesis and type your message in quotes. In the video I typed print("hi this is gabriel").
  • This tooltip is a big help while learning: you see how a function works without leaving the editor.
  • Tip: press Tab or Enter to accept a suggestion instead of typing the whole word.

Step 11Let VS Code close parentheses and quotes for you

A finished Python line print with hi this is gabriel in a Visual Studio Code editor tab, where the closing parenthesis and quotation marks were typed automatically by the editor
  • When you open a parenthesis or a quote, VS Code adds the closing one automatically. In the video all the quotation marks and the closing parenthesis were typed by the system.
  • That avoids one of the most common beginner errors: a missing ) or " that makes the whole line fail.
  • If you type the closing character yourself, VS Code just steps over it, so you don't end up with two.

Step 12Save the file

Visual Studio Code File menu open with New File, Open File, Open Folder, Save, Save As and Save All options, used to save a new Python file on Windows
  • Open File > Save (or press Ctrl+S). Give the file a name ending in .py, for example hello.py.
  • The .py extension tells VS Code (and Python) that this is a Python program.
  • To make another file, create a new one the same way; it works like a document in a word processor.
  • Common mistake: closing VS Code with an unsaved "Untitled" tab and losing your exercise.

Step 13Use the Edit menu: undo, redo, copy, paste, find

VS Code Edit menu on Windows listing Undo Ctrl+Z, Redo Ctrl+Y, Cut, Copy, Paste, Find Ctrl+F, Replace Ctrl+H, Find in Files and Toggle Line Comment shortcuts
  • The Edit menu has the same features you know from a word document: Undo (Ctrl+Z), Redo (Ctrl+Y), Cut, Copy, Paste, Find (Ctrl+F) and Replace (Ctrl+H).
  • It also has programmer tools like Find in Files (search the whole folder) and Toggle Line Comment (Ctrl+/).
  • That's the basic setup done: you have a free super text editor ready for the rest of the Python lessons.

Install the Python interpreter (VS Code doesn't include it)

Diagram showing the three pieces needed for Python in VS Code: the VS Code editor, Microsoft's Python extension and a separately installed Python interpreter, with py -3 --version and code --version checks

This is the part that confuses many beginners. Running Python in VS Code takes three separate pieces:

  1. VS Code, the editor where you write code.
  2. The Python extension, which connects VS Code to Python (IntelliSense, running, debugging).
  3. A Python interpreter, the program that actually runs your code. Microsoft's documentation is clear that the extension does not include Python itself.

In the video the status bar already shows a Python 3.9 interpreter from the Microsoft Store, because I installed Python in an earlier lesson. If your PC doesn't have it yet, install Python 3 from python.org (the first Download Python button), or from the Microsoft Store if you don't have admin rights.

To check it worked, open a new Command Prompt and run py -3 --version. If you install Python while VS Code is open, close and reopen VS Code (or at least its terminal) so it finds the new interpreter.

Run your first Python file in VS Code

The video stops after typing and saving the first line. When you're ready to run it, Microsoft's Python tutorial describes these options (with the Python extension and an interpreter installed):

  • Click the Run Python File play button at the top right of the editor. It opens a terminal and runs python hello.py.
  • Right-click in the editor and choose Run Python > Run Python File in Terminal.
  • Select a line and press Shift+Enter to send just that line to a Python terminal.

If VS Code asks which interpreter to use, open the Command Palette with Ctrl+Shift+P and run Python: Select Interpreter.

Note: save the file with a .py name first. An untitled tab may not offer the Run Python File button.

User setup vs System setup vs ZIP: which VS Code installer?

InstallerAdmin rightsInstalls toBest for
User setup (used in the video)Not needed%LOCALAPPDATA%\Programs\Microsoft VS CodeMost people; smoothest updates
System setupRequiredProgram FilesMaking VS Code available to all users on one PC
ZIP archiveNot neededAny folder you extract it toPortable use; you update it manually

One detail from Microsoft's docs: with the User setup, updates are disabled if you run VS Code as Administrator, so open it normally.

Troubleshooting a VS Code install on Windows

ProblemLikely causeFix
'code' is not recognized in the terminalOld terminal window, or Add to PATH was not tickedOpen a new terminal; if it still fails, run the installer again and tick Add to PATH
No suggestions when typing printFile is plain text, or the Python extension is not installedSelect Python as the language or save as .py; install the Microsoft Python extension
"Python is not installed" / no interpreter foundOnly the extension was installedInstall Python 3 from python.org or the Microsoft Store, then restart VS Code
Wrong Python version runsMore than one interpreter on the PCCtrl+Shift+P > Python: Select Interpreter
VS Code won't updateRunning a User setup as AdministratorStart VS Code normally (not "Run as administrator")

If your Windows PC is slow while installing or coding, check how to turn off Windows efficiency mode, and if you suspect the PC itself is infected, see how to remove viruses, spyware and trojans before installing developer tools.

Useful VS Code shortcuts for Python beginners

ShortcutWhat it does
Ctrl+Shift+XOpen the Extensions view (shown in the video)
Ctrl+Shift+PCommand Palette: run any command by name
Ctrl+SSave the file
Ctrl+Z / Ctrl+YUndo / redo
Ctrl+F / Ctrl+HFind / replace in the file
Ctrl+Shift+FFind in all files of the folder
Ctrl+/Comment or uncomment the current line

The Edit-menu shortcuts above are the ones shown in the video's Edit menu. Using a Mac instead? The same editor runs on macOS, and if you need Windows-only tools there, see how to install Windows 11 on an M1 Mac with Parallels.

What to do next

  • Make a folder for the course and open it with File > Open Folder.
  • Install Python if you haven't, then run your hello.py with the play button.
  • Change the message inside print() and run it again; small experiments are the fastest way to learn.
  • Keep VS Code updated: it ships updates regularly and asks you to install them.

Frequently asked questions

Is Visual Studio Code free?

Yes. VS Code is a free editor from Microsoft, built on open source, and runs on Windows, macOS and Linux.

Is Visual Studio Code the same as Visual Studio?

No. Visual Studio is a large IDE; Visual Studio Code is a lightweight code editor that you extend with extensions, like the Python extension in this guide.

Does VS Code come with Python?

No. You install a Python interpreter separately (python.org or the Microsoft Store). The Python extension connects VS Code to that interpreter.

What does Add to PATH do in the VS Code installer?

It lets you start VS Code from a terminal by typing code (for example code . to open the current folder). It only works in terminal windows opened after the install.

Do I need administrator rights to install VS Code?

Not with the User setup, which Microsoft recommends for most people. The System setup for all users needs admin rights.

Which Python extension should I install in VS Code?

The one named Python published by Microsoft. It adds IntelliSense, linting and debugging, and installs helpers such as Pylance and the Python Debugger.

How do I open the Extensions view in VS Code?

Click the Extensions icon in the left bar or press Ctrl+Shift+X.

Why doesn't VS Code suggest code when I type?

The file is probably still plain text. Select Python as the language (or save the file as .py) and make sure the Python extension is installed.

Need help with this?

Call, text or WhatsApp me at 859-878-0554.

Watch the video

12- How to install visual studio code on windows (Course Python 2021)

Original video: 12- How to install visual studio code on windows (Course Python 2021)

Comments

More articles

WhatsApp Visitors today: — This month: — Total: —