Home>Article>Development Tools> How to debug and run python programs in vscode

How to debug and run python programs in vscode

王林
王林 Original
2020-02-13 12:52:20 5264browse

How to debug and run python programs in vscode

Install extension

1. Click the Extension icon in the left menu bar of VSCode, enter Python to search, and search for the Python extension below Click to install.

2. Select the compiler, Ctrl Shift P, type Python: Select Interpreter, select the corresponding installed Python compiler

3. Install Linter. Generally speaking, after completing the extension installation, A message saying "Linter pylint is not installed" will appear. Click to install. This is used to prompt error messages.

Run the program

Select a folder, create a Python script file with the extension py, and you can run the program. There are several running methods:

1, F5

2, Enter in Terminal: python hello.py

3, Right-click on the program page and select "Run in Terminal" Python file”

Debugging

The debugging of Python is basically the same as that of C. Click the spider icon in the menu bar on the right to enter Debug. You can click on the program line number to set a breakpoint, F11 to single-step execution, watch the value of the variable in the Variable on the left, etc.

Related recommendations:vscode tutorial

The above is the detailed content of How to debug and run python programs in vscode. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn