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
Is vscode a good IDE for Python?
🌐 r/learnpython
161
133
October 24, 2023
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
🌐
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 ...
🌐
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.
🌐
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.
🌐
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 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 - This extension provides syntax highlighting, debugging tools, code navigation, refactoring, and test runners. It doesn’t provide linting, IntelliSense completion, or type checking.
🌐
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
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
🌐
YouTube
youtube.com › watch
How to Install Python 3.12.1 in VSCode (2026) - Python in Visual Studio Code - YouTube
In this video, I'll show you how you can Install Python 3.12.1 for VSCode. We will install python 3.12.1 and setup visual studio code for python programming....
Published: January 16, 2024
🌐
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
🌐
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....
🌐
Reddit
reddit.com › r/learnpython › is vscode a good ide for python?
r/learnpython on Reddit: Is vscode a good IDE for Python?
October 24, 2023 -

I use vscode for PHP already but I’m wondering if it’s functionality is good for Python too? If yes, any suggestions on extensions?