In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to configure Python in VSCode". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to configure Python in VSCode.
Come on! Python code error check:
Code error checking in Python usually uses pep8, pylint and flake8, and automatic formatting code usually uses autopep8, yapf, and black. All of these tools can be installed using pip, and here are two traditional ways to install using pip.exe and installing in VScode.
If you want to use flake8 or tools such as flake8 to work, the premise is that the "python.linting.enabled" value in the settings.json file must be set to "true", otherwise even if these tools are installed, there will be no error warning of the code.
/ / python-related configuration "python.linting.flake8Enabled": true, "python.formatting.provider": "yapf", "python.linting.flake8Args": ["--max--line-length=248"], "python.linting.pylintEnabled": false, "workbench.startupEditor": "newUntitledFile", "python.pythonPath": "C:\\ Users\\ lenovo\\ AppData\\ Programs\ Python\\ Python37\\ python.exe", "python.linting.enabled": true "editor.fontSize": 14, / / end python related configuration
Put the above configuration into settings.json
[traditional installation]
Take installation as an example, flake8, and the rest are similar
Method 1:
Open a command line window (press Win+R at the same time, enter cmd)
Enter: python-m pip install flake8, enter to run and wait for the result.
[note] the premise is that the path to python must be added to the environment variable.
Method 2:
Open a command line window (press Win+R at the same time, enter cmd)
Drag pip.exe directly into the cmd window
Enter: pip install flake8, enter and wait for the running result.
Method 3:
In the directory where pip.exe is located, press the right mouse button of Shift+ to open the PowerShell window (in previous versions of win10, you can open the command line window directly)
Enter: cmd, enter and run
Enter: pip install flake8, enter and wait for the running result.
[install in Vscode]
The code error tool takes flake8 as an example:
1. Open the settings in VScode and search for python.linting.flake8enabled
2. Check the box in the Settings interface
Whether to lint Python files using flake8
[install format in Vscode] VsCode when you press the format shortcut "Alt+Shift+F", you will be prompted to install the autopep8 automatic formatting tool in the lower right corner. Click yes to wait for the installation before formatting.
Thank you for reading, the above is the content of "how to configure Python in VSCode". After the study of this article, I believe you have a deeper understanding of how to configure Python in VSCode, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.