How to Install Python and Write Your First Program (Mac, Windows, Linux)
Last updated on
Installation
First of all you have to install python on your machine.
Depending on your operating system the steps may differ. But in MacOs and linux it’s just a matter of running a single command.
brew install python # MacOs
sudo apt install python3-full # Linux
On windows, just head to the python.org website, dowonload the corresponding binary, and make sure to check the “Add to PATH” option.
To confirm that it’s indeed installed, restart your terminal app, and then run:
python3 --version # or python --version
If a version number appears, then Python is succesfully installed on your system.
First Program: Hello World!
Let’s create our first Python program.
First, we need to create a “hello.py” file, open it with your preferred IDE, and then write a simple “print” statement that just prints “Hello, World!” to the console (the default standard output or “stdout”).
print("Hello, World!")
Output:
Now, let’s run out the previously created program by typing:
python3 hello.py # Or python
And then pressing on enter.
As expected a hello world gets printed on your console.
Output:
Hello, World!
You can also use Python’s interactive mode where any code you type executes line by line, by running the previous python3 command without any arguments.
python3

Enjoyed this article?
I'm currently open to new roles — remote-first or international. If something resonated or you'd like to collaborate, I'd love to hear from you.
This article was originally published on https://sidaliassoul.com/blog/how-to-install-python-and-run-your-first-program-mac-linux-windows/. It was written by a human and polished using grammar tools for clarity.