Here is how to configure Task Runner in Visual Studio Code to run a .py file.

In your console, press Ctrl + Shift + P (Windows) or Cmd + Shift + P (Apple). This brings up a search box where you search for "Configure Task Runner"

If this is the first time you open the "Task: Configure Task Runner", you need to select "other" at the bottom of the next selection list.

This will bring up the properties which you can then change to suit your preference. In this case you want to change the following properties;

  1. Change the Command property from "tsc" (TypeScript) to "Python"
  2. Change showOutput from "silent" to "Always"
  3. Change args (Arguments) from ["Helloworld.ts"] to ["${file}"] (filename)
  4. Delete the last property problemMatcher
  5. Save the changes made

You can now open your .py file and run it nicely with the shortcut Ctrl + Shift + B (Windows) or Cmd + Shift + B (Apple).

Answer from python_starter on Stack Overflow
๐ŸŒ
Visual Studio Code
code.visualstudio.com โ€บ docs โ€บ languages โ€บ python
Python in Visual Studio Code
November 3, 2021 - Working with Python in Visual Studio Code, using the Microsoft Python extension, is simple, fun, and productive. The extension makes VS Code an excellent Python editor, and works on any operating system with a variety of Python interpreters.
๐ŸŒ
Visual Studio Code
code.visualstudio.com โ€บ docs โ€บ python โ€บ python-tutorial
Getting Started with Python in VS Code
November 3, 2021 - By using the Python extension, you turn VS Code into a great, lightweight Python editor. If you are new to programming, check out the Visual Studio Code for Education - Introduction to Python course.
Discussions

How to set up python on vs code
I would suggest that you start off with Thonny IDE, as it requires virtually no "setting up", and even includes Python so that you don't need to set up Python either. It's a great IDE for beginners. When you have outgrown Thonny you will know a lot more about Python, so setting up vscode or PyCharm should be a lot easier for you. More on reddit.com
๐ŸŒ r/learnpython
13
10
October 17, 2024
How to execute Python code from within Visual Studio Code - Stack Overflow
Visual Studio Code was recently released and I liked the look of it and the features it offered, so I figured I would give it a go. I downloaded the application from the downloads page, fired it up, More on stackoverflow.com
๐ŸŒ stackoverflow.com
Python in Visual Studio Code โ€“ May 2022 Release

Microsoft announces the May 2022 release of the Python and Jupyter Extensions for Visual Studio Code introducing three new extensions: Black, isort, and Jupyter Powertoys.

More on reddit.com
๐ŸŒ r/Python
54
241
May 6, 2022
Any reason I should use PyCharm over Visual Studio Code?
Use whatever editor/IDE that makes you comfortable. Both Pycharm and VS Code are great tools. More on reddit.com
๐ŸŒ r/learnprogramming
25
19
March 5, 2019
People also ask

How do I set up VSCode to format Python code on save using Black?

To set up VSCode to format Python code using Black, go to Settings and search for "Python formatting provider", select "black", and ensure "Editor: Format On Save" is enabled.

๐ŸŒ
datacamp.com
datacamp.com โ€บ home โ€บ tutorials โ€บ python โ€บ setting up vscode for python: a complete guide
Setting Up VSCode For Python: A Complete Guide | DataCamp
How can I configure VSCode to use a specific Python interpreter for different projects?

You can specify a Python interpreter for each project by selecting the interpreter in the Command Palette (Ctrl+Shift+P) using the command "Python: Select Interpreter". This setting is saved in the project's .vscode/settings.json.

๐ŸŒ
datacamp.com
datacamp.com โ€บ home โ€บ tutorials โ€บ python โ€บ setting up vscode for python: a complete guide
Setting Up VSCode For Python: A Complete Guide | DataCamp
What are some recommended extensions for Python data visualization in VSCode?

For data visualization, extensions like Plotly for Visual Studio Code and Jupyter Notebook Renderers can enhance your experience by providing interactive plots and rendering capabilities.

๐ŸŒ
datacamp.com
datacamp.com โ€บ home โ€บ tutorials โ€บ python โ€บ setting up vscode for python: a complete guide
Setting Up VSCode For Python: A Complete Guide | DataCamp
๐ŸŒ
Visual Studio Code
code.visualstudio.com โ€บ docs โ€บ python โ€บ python-quick-start
Quick Start Guide for Python in VS Code
November 3, 2021 - To further customize VS Code for Python, you can leverage the Python profile template, automatically installing recommended extensions and settings. For Data Science projects, consider using the Data Science profile template. If you have an existing Python project you wish to work on in VS Code, you can begin by opening your folder or file from the VS Code Welcome page or File Explorer view, or by selecting File > Open Folder (Ctrl+K Ctrl+O) or File > Open File (โŒ˜O (Windows, Linux Ctrl+O)).
๐ŸŒ
DataCamp
datacamp.com โ€บ home โ€บ tutorials โ€บ python โ€บ setting up vscode for python: a complete guide
Setting Up VSCode For Python: A Complete Guide | DataCamp
December 3, 2024 - Note: Most Python development extensions and features come with Python extensions. Visual Studio Code allows users to simply run the data science code in Jupyter Notebook. We can run the cell and visualize the result within VSCode.
๐ŸŒ
Real Python
realpython.com โ€บ python-development-visual-studio-code
Python Development in Visual Studio Code โ€“ Real Python
July 3, 2026 - We assume you are familiar with Python development and already have some form of Python installed on your system (Python 2.7, Python 3.6/3.7, Anaconda, or others). Screenshots and demos for Ubuntu and Windows are provided. Because Visual Studio Code runs on all major platforms, you may see slightly different UI elements and may need to modify certain commands.
๐ŸŒ
Tom McFarlin
tommcfarlin.com โ€บ easily-set-up-and-use-visual-studio-code-and-other-tools-for-python-development
Use Visual Studio Code For Python Development | Tom McFarlin
September 1, 2023 - The Python extension provides various features, including code highlighting, code completion, linting, debugging, and more. If you opt to create a new file, youโ€™ll need to choose an environment type in the current workspace.
Find elsewhere
๐ŸŒ
The New Stack
thenewstack.io โ€บ home โ€บ how to use vs code for python (and why you should)
How To Use VS Code for Python (and Why You Should) - The New Stack
September 5, 2024 - echo -e "\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" | sudo tee /etc/yum.repos.d/vscode.repo > /dev/null ... Once you have VS Code installed, open it from your desktop menu and walk through the user-friendly onboarding wizard. The next thing to do is enable Python support.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ run-python-file-in-vscode
Run Python File In Vscode - GeeksforGeeks
July 23, 2025 - Launch VSCode, go to the Extensions view (w can press Ctrl+Shift+X), and search for "Python." Install the one provided by Microsoft, which is the official Python extension.
๐ŸŒ
Visual Studio Marketplace
marketplace.visualstudio.com โ€บ items
Python - Visual Studio Marketplace
Extension for Visual Studio Code - Python language support with extension access points for IntelliSense (Pylance), Debugging (Python Debugger), linting, formatting, refactoring, unit tests, and more.
๐ŸŒ
GitHub
github.com โ€บ microsoft โ€บ vscode-python
GitHub - microsoft/vscode-python: Python extension for Visual Studio Code ยท GitHub
A Visual Studio Code extension with rich support for the Python language (for all actively supported Python versions), providing access points for extensions to seamlessly integrate and offer support for IntelliSense (Pylance), debugging (Python ...
๐ŸŒ
Visual Studio Code
code.visualstudio.com โ€บ docs โ€บ python โ€บ run
Running Python code in Visual Studio Code
November 3, 2021 - The VS Code Native REPL for Python builds upon the classic Python REPL and provides additional features, such as Intellisense and syntax highlighting to make your Python development experience more efficient.
๐ŸŒ
InfoWorld
infoworld.com โ€บ home โ€บ software development โ€บ programming languages โ€บ python
Get started with Python in Visual Studio Code | InfoWorld
January 31, 2024 - Use the Python extension for Visual Studio Code to create, manage, run, and test Python projects easily.
๐ŸŒ
YouTube
youtube.com โ€บ watch
How to Run Python in Visual Studio Code on Windows 10/11 [ 2026 Update ] Python in VSCode - YouTube
Hello Everyone! Today in this video I am going to step-by-step guide you on How to Run Python in Visual Studio Code on Windows 10/11 [ 2024 Update ] VS Code ...
Published: January 8, 2025
๐ŸŒ
YouTube
youtube.com โ€บ watch
Setup Python in Visual Studio Code on Windows 10/11 [2026] | Run First Python Program - YouTube
Learn how to run Python in Visual Studio Code (VS Code) with this easy step-by-step guide (2026). This tutorial is perfect for beginners who want to set up a...
Published: April 13, 2026
๐ŸŒ
Microsoft Learn
learn.microsoft.com โ€บ en-us โ€บ visualstudio โ€บ python โ€บ tutorial-working-with-python-in-visual-studio-step-01-create-project
Tutorial: Create a Project Python in Visual Studio | Microsoft Learn
The language supports all kinds ... casual developers, and professional developers use Python. Visual Studio provides first-class language support for Python....
๐ŸŒ
Visual Studio Code
code.visualstudio.com โ€บ docs โ€บ python โ€บ editing
Editing Python in Visual Studio Code
November 3, 2021 - Visual Studio Code is a powerful editing tool for Python source code. The editor includes various features to help you be productive when writing code.
๐ŸŒ
Medium
samuelodekunle.medium.com โ€บ setting-up-vs-code-for-python-development-on-a-mac-a-step-by-step-guide-db583b7e9915
Setting Up VS Code for Python Development on a Mac: A Step-by-Step Guide | by Samuel Odekunle | Medium
November 25, 2024 - Go to the official Python website: https://www.python.org/downloads/ Download the latest stable release for macOS. Run the installer and follow the on-screen instructions. ... Open the downloaded file and drag the โ€œVisual Studio Codeโ€ ...
๐ŸŒ
YouTube
youtube.com โ€บ watch
How to Run Python in Visual Studio Code on Windows 10/11 [2025] | Run Sample Python Program - YouTube
Learn how to setup Python in VS Code, which is free to install and use. VS Code is an open source source-code editor and debugger, developed by Microsoft. Py...
Published: February 18, 2025