Steps:
(1) Open cmd.
(2) Go to the disk where the file you want to run is located (for example: E disk). Input: e: Enter
(3) Open the folder where the file you want to run is located (for example: E:\ABC\123). Input: cd E:\ABC\123 and press Enter
(4) Run the program. Input: python ***.py (the name of the program file) and press Enter
Extended information
Run under windows cmd python, you need to configure python environment variables. Now assume that python is installed in the D:\Python directory. The method of setting environment variables is as follows: Method 1. My Computer->Properties->Advanced->Environment Variables->System Variables , find PATH in the system variable, click "Edit", and add ";D:\Python" (no quotes) at the end
Recommended related tutorials:Python video tutorial
The above is the detailed content of How to run python in cmd. For more information, please follow other related articles on the PHP Chinese website!