A quick overview of setting up and running Python in Visual Studio Code on Windows 10…

Installation

  1. Install VS Code and Python.

  2. Set environment variable via PowerShell:

     [Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Python27\", "User")
    
  3. Install pylint via Shell:

     python -m pip install pylint
    
  4. Install the VS Code Python extension.

Running Code

When working with .py files your terminal should automatically update to Python.

Python Terminal

To run your code you can open the Command Palette Ctrl+Shift+P and search for Python: Run Python File in Terminal.

Command Palette

You can also create a keybind:

  • File > Preferences > Keyboard Shortcuts
  • Search for python.execInTerminal

Before running your code using this method, you must save your file each time.