Home  >  Article  >  Development Tools  >  How to connect vscode to python

How to connect vscode to python

尚
Original
2020-04-03 10:04:185507browse

How to connect vscode to python

1. Install Python

Install Python extension.

Install a python3 version.

2. Connect to Python

Select a python interpreter

If you want to run python code in vscode, you must tell vscode which interpreter to use.

How to connect vscode to python

You can open the command palette (Ctrl Shift P) and type Python: Select Interpreter and then select an interpreter. You can also directly click Select Python Environment in the picture above to make a selection.

This command displays a list of available interpreters that vscode can automatically find. If you do not see the required interpreter, click File>Preferences>Settings and set the value of python.pythonPath to select yours. The interpreter you want to use.

Run the file

The easiest way is to right-click and select Run in Terminal.

There are two other ways to run python in vscode:

Select a line and press shift enter to run this line of code directly.

Use the Python: Start REPL command in the command panel to open the python interpreter.

Recommended learning: vscode tutorial

The above is the detailed content of How to connect vscode to python. 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