Python on Visual Studio Code
Download VS Code - If you haven't downloaded VS Code yet, quickly install for your platform (Windows, Mac, Linux).
Install Python Extension
VS Code is a fast editor and ships with only the basic features. Add Python language support to VS Code by installing one of the popular Python extensions.
- Select an extension.
- Install the extension by typing
ext installinto the Command Palette ⇧⌘P (Windows, Linux Ctrl+Shift+P).
Tip: The extensions shown above are dynamically queried. Click on an extension tile above to read the description and reviews to decide which extension is best for you. See more in the Marketplace.
The examples in this document will use Don Jayamanne's popular and full featured Python Extension.
Python extensions support code completion and Intellisense. Intellisense is a general term for a number of features, including intelligent code completion (in-context method and variable suggestions) across all your files and for built-in and thirty-party modules.
Quickly see methods, class members, and documentation.
Tip: Trigger code completion with ⌃Space (Windows, Linux Ctrl+Space).
Linting is the analysis of your Python code for potential errors. Use Visual Studio Code to quickly navigate to the errors and warnings in your code.
Tip: Follow the instructions in the wiki for getting started with debugging, including setting up your
launch.jsondebugging configuration and troubleshooting common issues.
Tip: Read more about general information about debugging in Visual Studio Code in the debugging document.
Snippets will take productivity to the next level. You can configure your own snippets and use snippets provided by an extension.
Tip: Snippets appear in the same way as code completion ⌃Space (Windows, Linux Ctrl+Space).
- Install an Extension - Python extension are available in the Marketplace.
- Basic Editing - Learn about the powerful VS Code editor.
- Code Navigation - Move quickly through your source code.
Q: Why won't linting work for me?
A: First make sure you have installed an extension. Next, many extensions have a dependency on an external package. Install the required packages using a Python package manager like pip or easy_install. You can read more about troubleshooting linting issues here.