search
HomeDevelopment ToolsVSCodeHow to develop Python with VSCode? Introduction to development environment configuration

VSCodeHow to develop in Python? This article will introduce to you how to configure the Python development environment in VSCode.

How to develop Python with VSCode? Introduction to development environment configuration

#First of all, please make sure that the installation of VsCode and the configuration and installation of the Python environment have been completed! [Recommended learning: "vscode tutorial"]

First enter the extended search, enter "python" to search, click on the python plug-in as shown in the picture to install and restart VsCode.

How to develop Python with VSCode? Introduction to development environment configuration

Check whether Python is installed successfully:

  • Open the command prompt
  • Enter python press enter
  • Enter pip list to check whether the third-party package is correct

Install the third-party package:

  • Open the command prompt Symbol
  • Enter pip install flake8
  • Enter pip install yapf
  • These two packages will be used when configuring the Python environment of VScode

1. Create a new project

Create a new file test.py

How to develop Python with VSCode? Introduction to development environment configuration

2. Configure the work area (configure flake8 and yapf and close the pylint tool)

How to develop Python with VSCode? Introduction to development environment configuration

How to develop Python with VSCode? Introduction to development environment configuration

##Configure the following code:

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

How to develop Python with VSCode? Introduction to development environment configuration

3. Configure Python compilation settings

  • Click Debug on the left, select Add configuration, java, python will pop up, select Python will pop up the launch.json file

    How to develop Python with VSCode? Introduction to development environment configuration

    How to develop Python with VSCode? Introduction to development environment configuration

    ##Add the following configuration (so you don’t need to press it twice when compiling F5), if you want to debug step by step, just change false to true
  • "stopOnEntry":false,
4. Environment variable setting

Complete The above configuration does not allow us to debug and run the code in VScode
  • Because we have not configured the Python path in VScode
  • Open launch.json and enter it under the debugger used during debugging "pythonPath": Target path
  • "pythonPath": "你的pytho.exe所在的路径",

How to develop Python with VSCode? Introduction to development environment configuration

5. Configure the default task

To complete this step, you can Get the running results of the program directly through shortcut keys
  • Click on Terminal, select Configure Default Build Task, and open the task.json file
  • How to develop Python with VSCode? Introduction to development environment configuration

    Modify the following configuration
  • "group":{
        "kind":"build",
        "isDefault":true            
    }
6. Supplementary configuration

    File - > Preferences -> Settings -> open setting.json
  • How to develop Python with VSCode? Introduction to development environment configuration
    ##Add configuration in User Setting.json:

  • {
        "workbench.startupEditor": "newUntitledFile",
        "python.pythonPath": "你的python.exe路径",
        "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: 这是由Sunny Chen创建.
@param: 
@return: 
'''
list_a=[1,2]
list_b=[5,6]

ref_list_a=id(list_a)

for i in range(1,6):
    for j in range(1,6):
        print(str(j)+"\n")
    print(str(i)+"\n")
For more programming-related knowledge, please visit: Introduction to Programming

! !

The above is the detailed content of How to develop Python with VSCode? Introduction to development environment configuration. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:掘金社区. If there is any infringement, please contact admin@php.cn delete
Visual Studio Professional and Enterprise: Paid Versions and FeaturesVisual Studio Professional and Enterprise: Paid Versions and FeaturesMay 10, 2025 am 12:20 AM

The difference between VisualStudioProfessional and Enterprise is in the functionality and target user groups. The Professional version is suitable for professional developers and provides functions such as code analysis; the Enterprise version is for large teams and has added advanced tools such as test management.

Choosing Between Visual Studio and VS Code: The Right Tool for YouChoosing Between Visual Studio and VS Code: The Right Tool for YouMay 09, 2025 am 12:21 AM

VisualStudio is suitable for large projects, VSCode is suitable for projects of all sizes. 1. VisualStudio provides comprehensive IDE functions, supports multiple languages, integrated debugging and testing tools. 2.VSCode is a lightweight editor that supports multiple languages ​​through extension, has a simple interface and fast startup.

Visual Studio: A Powerful Tool for DevelopersVisual Studio: A Powerful Tool for DevelopersMay 08, 2025 am 12:19 AM

VisualStudio is a powerful IDE developed by Microsoft, supporting multiple programming languages ​​and platforms. Its core advantages include: 1. Intelligent code prompts and debugging functions, 2. Integrated development, debugging, testing and version control, 3. Extended functions through plug-ins, 4. Provide performance optimization and best practice tools to help developers improve efficiency and code quality.

Visual Studio vs. VS Code: Pricing, Licensing, and AvailabilityVisual Studio vs. VS Code: Pricing, Licensing, and AvailabilityMay 07, 2025 am 12:11 AM

The differences in pricing, licensing and availability of VisualStudio and VSCode are as follows: 1. Pricing: VSCode is completely free, while VisualStudio offers free community and paid enterprise versions. 2. License: VSCode uses a flexible MIT license, and the license of VisualStudio varies according to the version. 3. Usability: VSCode is supported across platforms, while VisualStudio performs best on Windows.

Visual Studio: From Code to ProductionVisual Studio: From Code to ProductionMay 06, 2025 am 12:10 AM

VisualStudio supports the entire process from code writing to production deployment. 1) Code writing: Provides intelligent code completion and reconstruction functions. 2) Debugging and testing: Integrate powerful debugging tools and unit testing framework. 3) Version control: seamlessly integrate with Git to simplify code management. 4) Deployment and Release: Supports multiple deployment options to simplify the application release process.

Visual Studio: A Look at the Licensing LandscapeVisual Studio: A Look at the Licensing LandscapeMay 05, 2025 am 12:17 AM

VisualStudio offers three license types: Community, Professional and Enterprise. The Community Edition is free, suitable for individual developers and small teams; the Professional Edition is annually subscribed, suitable for professional developers who need more functions; the Enterprise Edition is the highest price, suitable for large teams and enterprises. When selecting a license, project size, budget and teamwork needs should be considered.

The Ultimate Showdown: Visual Studio vs. VS CodeThe Ultimate Showdown: Visual Studio vs. VS CodeMay 04, 2025 am 12:01 AM

VisualStudio is suitable for large-scale project development, while VSCode is suitable for projects of all sizes. 1. VisualStudio provides comprehensive development tools, such as integrated debugger, version control and testing tools. 2.VSCode is known for its scalability, cross-platform and fast launch, and is suitable for fast editing and small project development.

Visual Studio vs. VS Code: Comparing the Two IDEsVisual Studio vs. VS Code: Comparing the Two IDEsMay 03, 2025 am 12:04 AM

VisualStudio is suitable for large projects and Windows development, while VSCode is suitable for cross-platform and small projects. 1. VisualStudio provides a full-featured IDE, supports .NET framework and powerful debugging tools. 2.VSCode is a lightweight editor that emphasizes flexibility and extensibility, and is suitable for various development scenarios.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft