The first error most people meet in Python is not in their code. It shows up before they have written a single line, and it looks like this:
'python' is not recognized as an internal or external command
That message feels like a wall. It is not. It just means the computer does not yet know where Python lives. This part gets Python installed on your machine, gets that message to go away, and ends with a real program running from a file you wrote. Twenty focused minutes, and you will be past the setup that stops a lot of people.
You need nothing before this except a computer you can install software on and about twenty minutes. This part follows straight on from Part 1, where we ran a one line program; here you get the tools to run that same line yourself. Everything below you can type as you read. Copying works too, with one warning I will repeat later: pasted quote marks sometimes break.
Get Python onto your machine
Windows, macOS and Linux each handle this a little differently, so find your system below and ignore the other two. In every case the download comes from one place: python.org/downloads. Use the official installer, not a random bundle from a search result. The current release as you read this is Python 3.14; any 3.13 or 3.14 build is fine for this whole series.
| Your system | How to install | The command you will use |
|---|---|---|
| Windows 10 or 11 | Download the Windows installer from python.org and run it | python or py |
| macOS | Download the macOS installer from python.org and run it | python3 |
| Linux (Ubuntu, Debian) | Usually already there; if not, install with apt | python3 |
Table 1. Where to get Python and what to type once it is installed.
Windows
Go to python.org/downloads and click the yellow button that offers the latest Python for Windows. Open the file it downloads. On the very first screen of the installer there is a checkbox at the bottom that reads Add python.exe to PATH. Tick it. This one checkbox is the difference between the setup just working and that "not recognized" error above. Then click Install Now and let it finish.
PATH is simply the list of folders your computer searches when you type a command. Ticking the box adds Python to that list, so typing python anywhere finds it.
macOS
Macs ship with old Apple tools but not with a Python you should build on, so install a fresh one. Download the macOS installer from python.org and run it, clicking through the steps. When it finishes you will use the command python3, not python. On a Mac, plain python often does not exist at all, and that is normal.
Linux
Most Linux systems already include Python 3. Open a terminal and check first before installing anything. If it is missing on Ubuntu or Debian, one command fixes it:
sudo apt update sudo apt install python3
The word sudo runs the command with administrator rights, so it may ask for your password. On Linux you also use python3 as the command.
Check that it actually worked
Before writing anything, confirm the interpreter is reachable. The interpreter is the program that reads your Python and runs it; you met it in Part 1. Open a terminal. On Windows that is the app called Command Prompt or PowerShell. On macOS it is Terminal. On Linux it is your usual terminal. Type the version command for your system:
python --version
python3 --version
You should see something close to this, though the last number will vary:
Python 3.14.6
If you see a version number, Python is installed and on your PATH. You are ready. If instead you get "not recognized" on Windows or "command not found" on macOS or Linux, the interpreter is not on your PATH yet. On Windows the usual cause is the unchecked box from a minute ago; the quickest fix is to run the installer again, choose Modify, and make sure PATH is selected, or just type py --version instead, because the Windows installer also gives you a launcher called py that works even when python does not.
Two ways to run Python
There are two ways to hand instructions to the interpreter, and beginners get confused when a tutorial silently switches between them. Knowing both, and when each is used, clears up a lot.
The first is the interactive prompt, also called the REPL. You type one line, press Enter, and see the result immediately. It is a scratchpad. The second is a script: you save your instructions in a .py file and run the whole file at once. That is how real programs are built and shared.
Figure 1. The REPL is for quick tries. A script file is for programs you keep.
Open the REPL now. Type python on Windows or python3 on macOS and Linux, with no filename after it, and press Enter. The prompt changes to three greater-than signs:
>>> 2 + 2
4
>>> print('hi')
hiThose three signs mean Python is waiting for a line. Try a little arithmetic. When you are done, type exit() and press Enter to leave. The REPL is perfect for checking "what does this one line do", but it forgets everything when you close it. For anything you want to keep, you need a file.
Your first program in a file
Create a folder for this series so your files do not scatter. Inside it, make a new plain text file named hello.py. You can use any editor: Notepad on Windows, TextEdit on macOS in plain text mode, or a code editor like VS Code, which is free and what most people settle on. Put this single line in it and save:
print('Hello, world!')Now run it. In your terminal, move into the folder you saved it in using cd, which stands for change directory, then run the file. Notice the path separator differs by system: Windows uses a backslash, macOS and Linux use a forward slash.
cd Documentspython-series python hello.py
cd Documents/python-series python3 hello.py
Hello, world!
That is a real program. You wrote it, saved it, and the interpreter ran it from top to bottom. Everything else in this series is more of this: more lines, more ideas, same loop of write, save, run.
The error you will probably hit
A very common first stumble is running the command from the wrong folder. If the terminal is not in the folder where hello.py lives, Python cannot find the file and says so:
python: can't open file 'hello.py': [Errno 2] No such file or directory
Read that last line. "No such file" means Python looked and did not find hello.py where you are standing. The fix is to cd into the correct folder first, or type the full path to the file. This is not a Python fault and not a sign you did anything wrong. It is the single most common setup hiccup, and now you know its one line by sight.
The project starts here
Across this series you will build one real program a little at a time: a command line expense tracker that records what you spend. By the end it is a finished piece you can show in an interview. It starts now, with the smallest possible version, so you can prove your setup runs a file of your own.
Make a second file next to hello.py called expenses.py with one line in it:
print('My Expense Tracker')My Expense Tracker
Run it the same way you ran hello.py. One printed title line is not much yet, but this file is the seed of everything. In Part 3 it starts holding an amount and a category. Keep the file; do not delete it between parts.
When install goes sideways
Most setup problems are one of a handful of things. Here they are with the cause and the fix, so you can match a message to an answer instead of guessing.
| What you see | What it means | The fix |
|---|---|---|
| ‘python’ is not recognized (Windows) | Python is not on your PATH | Re-run installer, tick Add to PATH, or use py |
| command not found (macOS, Linux) | Wrong command name | Use python3, not python |
| can’t open file ‘hello.py’ | Wrong folder | cd into the folder, then run again |
| SyntaxError near a quote | Curly quotes from copying | Retype the straight quote marks |
Table 2. The four setup messages nearly everyone meets, and what to do.
Asha ready
Show solution
print('Asha')
print('ready')Two separate print lines make two output lines. Use your own name in place of Asha. Each print ends its line for you.
Questions that come up right after installing
Do I need to pay for anything, or install an IDE? No. Python is free, and the official installer already includes a simple editor called IDLE. A text editor and a terminal are enough for this whole series. Many people add VS Code later because it is pleasant, but it is optional.
Windows offers Python in the Microsoft Store. Should I use that instead? The python.org installer is the more predictable choice for learning, because paths and permissions behave the way tutorials assume. The Store version works, but if a command acts strangely, the official installer removes one variable.
I have Python 3.11 already. Do I need to upgrade to 3.14? No. Anything from 3.11 onward runs everything in this series. Upgrade when it is convenient, not as a blocker to starting.
Why does my Mac say python3 but the tutorial says python? On macOS and Linux the command is python3. On Windows it is usually python or py. Same interpreter, different name by system. Use whichever your machine recognizes.
My terminal shows a different version number than yours. Is that a problem? No. Patch numbers like 3.14.6 change often. As long as it starts with 3, you are set.
References
Python.org downloads · Python setup and usage (official docs) · Using the Python interpreter


DrJha