Home > Article > Backend Development > How to run py file in python
How to run py file in python: First copy the path where the py file is stored in the resource manager, and open the command line; then switch to the path of the py file; then enter "python file name.py" ; Finally, press the Enter key, and you can see that the py file in the window starts to run.
The operating environment of this tutorial: Windows 7 system, python version 3.9, DELL G3 computer.
How to run py files in python:
1. First, copy the path where the py files are stored in the resource manager, press the windows key + r, and run Enter cmd and press Enter to open the command line:
2. In the command line, first switch to the path of the py file, then enter "python filename.py" to run python file:
3. Press the Enter key and you will see that the py file in the window starts to run. Note that when running the py file on the command line, you need to change the python installation path. Add it to the environment variable path, otherwise an error will be reported and the command cannot be found. At this point, the operation of running the python file is completed:
Related free learning recommendations: python video tutorial
The above is the detailed content of How to run py file in python. For more information, please follow other related articles on the PHP Chinese website!