1. First, you need to ensure that the Python plug-in of VScode is installed. Open the Python script. You can drag it in directly, click on the file, and click on the user settings in the preferences. At this time, the user settings configuration will be displayed. document.
2. Then search for Python keywords in the left file Ctrl F and find the line where pythonPath is located
3. Then Copy the file where Python is located to the file on the right, pay attention to the direction of the slash, delete the trailing comma, and press Crtl+S after completion to save
4, and then switch to our program again file, Ctrl shift B to run the program. At this time, you will be prompted to configure the task runner, click Configure
5, and select Run any external command menu
6 . In the opened tasks.json file, two contents need to be modified, the path and the execution file name
7. After the final configuration is completed, the Python code can now be Ctrl shift B Directly ran
# Recommended related articles and tutorials: vscode tutorial
The above is the detailed content of How to run python files with vscode. For more information, please follow other related articles on the PHP Chinese website!