Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python VScode Configuration

Python VScode Configuration

In the previous chapter we installed the Python environment; this chapter introduces Python VScode configuration.

Preparation:

Install VS Code

VSCode (full name: Visual Studio Code) is a free cross-platform source code editor developed by Microsoft; the VSCode development environment is very simple and easy to use.

Installing VSCode is also simple: open the official site https://code.visualstudio.com/, download the package and install it step by step. During installation, pay attention to the installation path setting and that environment variables are added to the system automatically; check all the following options:

For the full VSCode installation tutorial, see:https://www.runoob.com/vscode/vscode-tutorial.html

Next we install the Python extension:


Create a Python code file

Open VScode and click New File:

Click to select the language:

Type Python in the search box and select the Python option:

Enter the code:

print("Runoob")

Right-click and choose Run File in Interactive Window;if prompted to install extensions, just click Install (without it, it keeps showing "Connecting to Python kernel"):

Alternatively, we can open an existing file or directory (folder); for example, open a runoob-test folder, or create one yourself:

Then we create a test.py file: click the new file icon below and enter the file name test.py:

**Note:** runoob-test contains a .vscode folder with some configuration information; you can ignore it for now.

Enter the following code in test.py:

print("Runoob")

Click the green icon in the top-right corner to run:

You can also right-click the file and choose "Run Python File in Terminal":

Of course you can also right-click in the code window and choose "Run Python File in Terminal".


More Related Tools