How to launch Python files using Windows Command Prompt

Author: Monica Porter
Date Of Creation: 13 March 2021
Update Date: 1 July 2024
Anonim
How To Run Python Scripts With The Command Prompt
Video: How To Run Python Scripts With The Command Prompt

Content

This wikiHow teaches you how to open Python files using the Command Prompt program built into your Windows computer. In most cases, you will open the file without any problems as long as Python is available on the machine. If your computer uses an old version of Python, or you customized it when installed and did not add the "python" command to your list of "Path" variables, add Python to your list of "Path" variables so you can start. Run Python files through Command Prompt.

Steps

Part 1 of 3: Finding the Python file path

  1. . Click the Windows logo in the lower left corner of the screen. The Start menu will pop up.

  2. Command Prompt appears at the top of the Start menu. Command Prompt will open.
  3. .
  4. Click the card View (View mode).
  5. Check the box "Hidden items".
  6. . A menu will pop up.
    • You can also press ⊞ Win+X to open the Power User pop-up menu.

  7. Click an option System (System) is in the pop-up menu. A new window will open up.
  8. Click System info (System information). This link is in the upper-right corner of the window. The System Information window will open.

  9. Click on the link Advanced system settings (Advanced system settings). This link is in the upper left of the System Information window. At this point, another window will pop up.
  10. Click Environment Variables ... (Environment variable). This option is in the lower-right corner of the pop-up window.
  11. Find the "Path" heading in the "User variables" panel. This frame is at the top of the Environment Variables window.
    • You may need to scroll your mouse cursor up or down on the "User variables" box to find the "Path" variable.

  12. Double-click the "Path" heading. A window will pop up.
  13. Click an option new (New) is located on the right side of the window. A text field will appear in the middle of the window.

  14. Paste the path you copied earlier. Press Ctrl+V to paste the content. The path you copied will appear in the text field in the middle of the window.

  15. Click OK three open windows. The system will save your changes and close the three windows "Path", "Environmental Variables" and "System Properties". advertisement