Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to configure Python Development Environment in VSCode

Shulou Source: shulou.com Published: 2022-06-02 05:39:27 11月25日 Update

VSCode how to configure the Python development environment, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Check that Python is installed successfully:

Open a command prompt

Enter python to enter enter

Enter pip list to check whether the third-party package is correct

Install the third-party package:

Open a command prompt

Enter pip install flake8

Enter pip install yapf

These two packages will be used when configuring VScode's Python environment

1. Create a new project

two。 Configure the work area (configure flake8 and yapf and close the pylint tool)

Configure the following code:

{"python.linting.flake8Enabled": true, "python.formatting.provider": "yapf", "python.linting.flake8Args": ["--max--line-length=248"], "python.linting.pylintEnabled": false}

3. Configure Python compilation settings

"stopOnEntry": false

4. Setting of environment variables

Completing the above configuration does not allow us to debug and run code in VScode

Because we haven't configured the Python path in VScode yet.

Open launch.json and type "pythonPath" under the debugger you are using when debugging: target path

"pythonPath": "the path of your pytho.exe"

5. Configure default tasks

To complete this step, you can get the running result of the program directly through the shortcut keys.

Click Terminal (terminal), select Configure Default Build Task (configure default generation task), and open the task.json file.

Modify the following configuration

"group": {"kind": "build", "isDefault": true}

6. Supplementary configuration

File-> Preferences-> Settings-> open setting.json

Add a configuration in User Setting.json:

{"workbench.startupEditor": "newUntitledFile", "python.pythonPath": "your python.exe path", "python.linting.enabled": false, "editor.fontSize": 14}

7. Save the changes, restart VScode, and open the file for debugging:

'' @ name: Sunny Chen@test: test font@msg: this is created by Sunny Chen. @ param: @ return:''list_a= [1pim2] list_b= [5Magne6] ref_list_a=id (list_a) for i in range (1Magee 6): for j in range (1pc6): print (str (j) + "\ n") print (str (I) + "\ n") does it help you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Tags: Configuration input path environment code task command prompt file third party help prompt check run development clear successful two content area Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn macOS Huawei Shulou Technology NVidia