Python Learning (1) Development Environment deployment and python Development Environment deployment
Brief description:
1. Set Environment Variables
2. vscode python Environment Settings
3. hello world
1. Set Environment Variables
Whether on windows or linux, the first step is to download the python installation package and set the python environment.
Environment variable: path: d: \ python \ Python36 \; d: \ python \ Python36 \ Scripts \
Test whether the setting is successful: Open the Command Prompt window and enter: python
Ii. vscode python Development Environment Settings
The development tool uses vscode, file-> preferences-> user settings to open settings. modify the configuration on the right side of the json configuration file. If you do not want to modify the global configuration, select workspace settings from the user settings drop-down list. This will only affect the current program.
3. hello world
You can develop it...
A. Interactive Programming
It seems very high. Input print ("hello world") in the Command Prompt window and press enter to wait for the result. This is interactive programming. exit () to exit python.
B. Script Programming (command line mode)
Create a file py_helloworld.py, input print ("hello world"), save the file, and input python py_helloworld.py in the command line... This is Script Programming.
C. Use vscode development tools
Open vscode and install python Extension
To open the folder where py_helloworld.py is located, use tasks. json (runtime environment configuration) and launch. json (debugging environment configuration ). (The default tasks. json and launch. json can also be used. If you do not want to create them, run F5 directly)
Task. json: task-> Configure task-> Create task. json file with template-> other, and change Command to python
1 { 2 // See https://go.microsoft.com/fwlink/?LinkId=733558 3 // for the documentation about the tasks.json format 4 "version": "2.0.0", 5 "tasks": [ 6 { 7 "taskName": "echo", 8 "type": "shell", 9 "command": "python"10 }11 ]12 }
Launch. json: Debug-> enable configuration-> python, which can be left unchanged. (StopOnEntry: stops at the first line of the program. You can configure the first breakpoint of the program during debugging)
F5 run