Configure the Python development environment in VScode

1. Install python

Official website download address: https://www.python.org/ftp/python/3.8.0/python-3.8.0-amd64.exe
Double-click to open the .exe file,
check the Add Python 3.8 to Path option, and then click install now can be installed.
insert image description here

installing:
insert image description here

After the installation is complete, click close.

2. Test

Press win+r on the keyboard, enter cmd in the run window in the lower left corner, and press Enter.
insert image description here
Type python in the pop-up window and press Enter. Get the following display.
insert image description here

Enter 1+1 after the prompt >>> and press Enter to display 2.
insert image description here

Successful installation.

3. Install VScode

Official website download address: https://code.visualstudio.com
Find the downloaded installation package, double-click to open it, and keep clicking Next.

4. Set VScode

Open the installed VScode, you can first set up the Chinese interface and solve the problem of garbled Chinese comments. For detailed steps, see the previous blog: https://blog.csdn.net/weixin_43737995/article/details/104214032?spm=1001.2014.3001.5502
Follow the steps below to search and install.

insert image description here
Add a python folder ready to store the code.

insert image description here
Open the settings.
insert image description here

insert image description here
Enter the following code in settings.json to configure flake8 and yapf and close the pylint tool.

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

insert image description here
Save and close.

5. Test

Create a new python file under the selected folder, ending with .py.
Enter the code to test in the file:

print('hello world')

Run it and see the results.

insert image description here
If the output is normal, the installation is complete.

Guess you like

Origin blog.csdn.net/weixin_43737995/article/details/125690015