How To Run Python Files From Command Prompt / Terminal On Windows / MacOS!

Manpreet Singh
3 min readOct 23, 2020

You may be a beginner in programming, I am obviously a beginner in writing articles (hence the amount of sentence errors), but just like any beginner, it is very important to understand the basics. One of the most important things when programming is running the programs, in this article you will become a master on running your programs on MacOS or Windows.

Before continuing on you want to make sure you have Python installed on your machine, here is an article I wrote that explains exactly how to do that.

First of all, let’s go ahead and create a sample python file. Go to any text editor of your choice (or even a Python IDE) and open up a blank page. You want to paste this inside your file: “print(“Hi”)”, just like this:

Go ahead and save this file as anything, but make sure the ending of it is “.py”, this will allow this file to pretty much be seen as a Python file, so make sure your file looks something like this:

Now that we have a sample python file, we can go ahead and run a script in our terminal to run this file. The process is a little bit different on both Windows and…

--

--