How to Run a Python File in Terminal

How to Run a Python File in Terminal

How do I run a python file?

The most basic and the easy way to run Python scripts is by using the python command. You need to open a command-line and type the word python followed by the path to your script file, like this: python first_script.py Hello World! Then you hit the ENTER button from the keyboard and that’s it.

How do I run python from command-line?

Open Command Prompt and type “python” and hit enter. You will see a python version and now you can run your program there.
James H. Sterling
Author

James H. Sterling

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.