Debug Python with VS Code

Preparation

Installation

Python official homepage Install Python from the link above

Extension installation

Python Press Command Pared (Ctrl + P) and execute the following command

Command pared


ext install python

debug

A. Press Command Pared (Ctrl + P) and execute the following command

Debug pared


> debug: Open launch.json

B. Press the launch.json button in the debug sidebar image

Created launch.json file

json:.vscode/launch.json


{
	"version": "0.2.0",
	"configurations": [
		{
			"name": "Python",
			"type": "python",
			"request": "launch",
			"stopOnEntry": true,
			"program": "${file}",
			"debugOptions": [
				"WaitOnAbnormalExit",
				"WaitOnNormalExit",
				"RedirectOutput"
			]
		},
....abridgement
option argument
"program": "${file}" Starts the currently active file
"program": "${workspaceRoot}/file.py" File at root.Start py

After editing launch.json, start debugging with F5 image

launch.json options

option Description
program Path to the Python file to be debugged
pythonPath Absolute path of Python interpreter,Use when you want to use multiple versions of Python properly
args Arguments passed to execution
stopOnEntry If enabled, it will stop at the first line when starting debugging
externalConsole If enabled, console/It will be displayed in the terminal window
debugOptions Debugging options
env Used to set Custom environment variables for the debugging process

Recommended Posts

Debug Python with VS Code
Debug with VS Code using boost python numpy
Install python with mac vs code
Python (Windows 10) Virtual Environment / Package with VS Code
Use Python in Anaconda environment with VS Code
Make your Python environment "easy" with VS Code
Build a python execution environment with VS Code
Get country code with python
Debug with PEPPER python interpreter
Document Python code with Doxygen
Try touching the micro: bit with VS Code + Python
Allow real-time code checking in Python development with VS Code
VS Code settings for developing in Python with completion
Revive symbol search in Python workspace with VS Code
Remote debug Django environment created with docker-compose with VS Code
Debug python multiprocess program with VSCode
Try running Jupyter with VS Code
I want to debug with Python
[VS Code] ~ Tips when using python ~
Settings when developing App Engine / Python apps with VS Code
Let's run jupyter natively supported by VS Code with python3.8
Settings to debug the contents of the library with VS Code
The story that Python stopped working with VS Code (Windows 10)
Build a Python environment with WSL + Pyenv + Jupyter + VS Code
FizzBuzz with Python3
Scraping with Python
Statistics with python
Scraping with Python
Python with Go
VS Code settings
Integrate with Python
AES256 with python
Tested with Python
Pass PYTHONPATH in 1 minute with VS Code
Display Japanese graphs with VS Code + matplotlib
python starts with ()
with syntax (Python)
Debug for mysql connection with python mysql.connector
[Python] Algorithm-aware code
Bingo with python
Zundokokiyoshi with python
VS Code Pylint is annoying with import! !! !! !!
Debug settings in virtual environment when using Pipenv with VS Code
Create a simple Python development environment with VS Code and Docker
How to build Python and Jupyter execution environment with VS Code
Excel with Python
Microcomputer with Python
Cast with python
Prepare a Python virtual environment for your project with venv with VS Code
I was addicted to creating a Python venv environment with VS Code
Steps to create a Python virtual environment with VS Code on Windows
VS Code + Azure Functions + Python environment construction procedure
Access Cyclone V's Lightweight HPS-to-FPGA Bridge with Python
Build Python development environment with Visual Studio Code
I tried Flask with Remote-Containers of VS Code
Automatically format Python code into PEP8-compliant code with Emacs
Convert the character code of the file with Python3
Static analysis of Python code with GitLab CI
Use Docker development container conveniently with VS Code
[VS Code] Python language Server no longer starts
[Blender x Python] Think of code with symbols