Python for Visual Studio Code

Visual Studio Code (VSC) is a free cross-platform source code editor. The Python for Visual Studio Code extension allows VSC to connect to Python distributions installed on your computer.

If you’ve installed Anaconda as your default Python installation and installed Python for Visual Studio Code, your VSC installation is already set to use Anaconda’s Python interpreter.

  1. Create a new Python source code file:

    1. To choose a directory to place the code, in the File menu, select Open.
    2. In the File menu, select New File. Your screen will now look like this:

  2. To associate the new file with the Python interpreter, at the bottom of the window, click Plain Text:


  3. In the menu that displays, type or select Python.

  4. In the pane on the right, add source code:


  5. To save the file, in the File menu, select Save.

  6. To open the Debug pane, click the bug icon. Click the gear icon, and then select Python:


  7. At the top-right, click the green run arrow next to Python.

    The source code is run using your Anaconda Python interpreter: