Setting Up Quarto with VS Code and Python on Win 11
- Prerequisite
Windows 11 operating system
We will rely heavily on the winget utility,
run from PowerShell (as administrator).
Required Software with Brief Installation Instructions
- Python
winget install Python- Visual Studio Code
winget install Microsoft.VisualStudioCode- Quarto
winget install --id=Posit.Quarto -e
- Python packages:
python -m pip install -U jupyter matplotlib plotly- Quarto VS Code Extension
Open VS Code and install three extensions from the Visual Studio Marketplace: Python, Jupyter, and Quarto.
Create a Quarto document
Open VS Code in your desired folder and create a new file with the .qmd extension (or open an existing file).
Render the document (from the menus, or use the keyboard shortcut: :kbd:`Ctrl+Shift+K`)
For more details, read about Quarto markdown.
Troubleshooting
Verify that VS Code is using the intended Python.
Check Python version in PowerShell:
python --version
If needed (probably not), update
settings.json.{ "python.defaultInterpreterPath": "mypath\\to\\python" }(This can be set at the user, workspace, or folder level.)
Metadata
Project Metadata
Place project metadata in a _quarto.yml configuration file in the project directory. Documents rendered within the project directory inherit this metadata defined at the project level. Usually you will want to direct output to a dedicated folder, to avoid cluttering your project directory. (Ask git to ignore this output folder.)
Example contents of _quarto.yml:
project:
output-dir: _output
eol: unix
toc: true
number-sections: true
format:
html:
css: styles.css
html-math-method: katex
pdf:
documentclass: article
For more details, see the documentation for Project Profiles.