Python3 Development Tool


Python VSCode Configuration

In the previous chapter, we have installed the Python environment. In this chapter, we will introduce the configuration of Python VScode.

Ready to work:

  • Install VS Code

  • Install VS Code Python extension

  • Install Python 3

Install VS Code

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

VSCode installation is also very simple. Open the official website https://code.visualstudio.com/ , download the software package, and install it step by step. During the installation process, pay attention to the installation path setting and the environment variables are automatically added to the system by default. Check all the following options :

image.png


Then we install the VS Code Python extension by Microsoft:

image.png


Create a Python Code File

Open VScode, and click New File:

image.png

Click to select language:

image.png

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

image.png

Enter code:

print ( "TutorialFish.com" )


Run a Python script

Right-click the mouse and choose to run the file in the interactive window. 

If there is a prompt that you need to install the extension ipykernel, just click Install.

image.png


In addition, we can also open an existing file or directory (folder). For example, if we open a tutorialfish-test, you can also create one yourself:

image.png

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

image.png

Enter the following code in test.py:

print ( "TutorialFish.com" )

Click the arrow icon in the upper right corner to run:

image.png

You can right-click the file and select:

Run Python File in Terminal

Run Current File in Interactive Window

image.png


You also can also right-click on the code window and select "Run Python file in terminal".