Python Learning (1) Development Environment deployment and python Development Environment deployment

Source: Internet
Author: User

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

    

    

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.