How to Install Python
You know Python is installed when your computer answers two questions: Can it find the python command? And can that command run code and print output? This…

You know Python is installed when your computer answers two questions: Can it find the python command? And can that command run code and print output? This guide shows you how to get there—step by step, on Windows, Mac, or Linux—so you can move from copy-pasting commands to actually building with Python.
What Does Success Look Like?
Before you start, see the finish line: a working Python setup means you can do three things:
- Check the version:
- Run
python --versionorpython3 --versionin your terminal or command prompt. You should see something likePython 3.11.5.
- Run
- Open the Python REPL:
- Run
python(Windows) orpython3(Mac/Linux). You should see the>>>prompt.
- Run
- Run a test command:
- At the
>>>prompt, type:
You should see:print("Hello, Python!")Hello, Python!
- At the
Preview only: This is your finish line. Don't worry if these steps fail right now—by the end of this guide, you'll be able to do all three.
The Three-Part Model: Interpreter, Terminal, and PATH
Installing Python is not just about downloading a file. There are three moving parts:
<!-- worldmonger:diagram:start id="python-installation-three-part-model" -->How the interpreter, terminal, and PATH work together to let you run Python from anywhere on your computer.
<!-- worldmonger:diagram:end id="python-installation-three-part-model" -->- The Python interpreter: The program that runs your code.
- The terminal or command prompt: The place where you tell your computer to run Python. On Windows, it's Command Prompt; on Mac or Linux, it's Terminal.
- PATH: The system's way of knowing where to find the
pythoncommand. If PATH is set up wrong, your computer can't find Python, even if it's installed.
Keep this model in mind as you work through the steps. Each part needs to connect for Python to run.
Step 1: Check If Python Is Already Installed
Don't install Python twice. First, see if it's already there.
On Windows:
- Open the Start menu, type
cmd, and press Enter to launch Command Prompt. - Type:
orpython --versionpy --version - Press Enter. If you see a version number (like
Python 3.11.5), Python is installed.
On Mac:
- Open Terminal (Applications > Utilities > Terminal).
- Type:
python3 --version - Press Enter. If you see a version number, Python 3 is installed.
On Linux:
- Open Terminal.
- Type:
python3 --version - Press Enter. Most distributions include Python, but the version may vary.
Tip: If you get an error or no version appears, you need to install Python.
Step 2: Download Python Safely
Always download Python from the official source. This avoids malware and ensures you get the latest stable release.
- Go to python.org/downloads.
- The site detects your operating system and suggests the right installer.
- Download the latest version (Python 3.x.x) for your platform.
Warning: Never download Python from random websites or file-sharing services. The official site is the only safe source.
Step 3: Install Python on Your System
Windows Installation
- Double-click the downloaded installer (e.g.,
python-3.x.x.exe). - Important: Check the box labeled Add Python to PATH before clicking "Install Now." This lets you run Python from any command prompt. (PATH is how Windows knows where to find Python when you type
python.) - Click Install Now. Wait for the installer to finish.
- Click Close when done.
Verify Installation:
Open Command Prompt and type:
python --version
You should see the Python version number. If not, restart your computer and try again.
Common mistake: Forgetting to check "Add Python to PATH" means you'll have trouble running Python from the command line. If this happens, rerun the installer and choose "Modify," then add Python to PATH.
Mac Installation
- Open the downloaded
.pkgfile (e.g.,python-3.x.x-macosx.pkg). - Follow the installer prompts.
- When finished, close the installer.
Verify Installation:
Open Terminal and type:
python3 --version
You should see a version number.
Note: On Mac (and Linux), use
python3instead ofpython. This avoids confusion with older Python 2 versions that may still be present.
Linux Installation
Most Linux distributions already include Python. To check:
python3 --version
If you need to install or upgrade Python, use your distribution's package manager:
- Ubuntu/Debian:
sudo apt update sudo apt install python3 - Fedora:
sudo dnf install python3 - Arch Linux:
sudo pacman -S python
Check again with:
python3 --version
Tip: If you want to install a specific version or need Python for development, consult your distribution's documentation for advanced options.
Step 4: Test Your Python Setup
Now, prove your install works by running the same test from the finish line preview:
1. Open your terminal or command prompt:
- On Windows: Command Prompt
- On Mac/Linux: Terminal
2. Start Python:
- On Windows, type:
python - On Mac/Linux, type:
python3
You should see something like:
Python 3.x.x (default, ...)
>>>
The >>> prompt means you're inside the Python REPL (Read-Eval-Print Loop)—an interactive place to run Python code.
3. Type Python code at the >>> prompt:
print("Hello, Python!")
Expected output:
Hello, Python!
Note: Only type the
print(...)line after you see the>>>prompt. That's how you know you're inside Python, not just the system shell.
To exit Python, type exit() and press Enter, or close the window.
What If Something Goes Wrong?
- Command not found: Double-check your spelling. On Windows, try
pyinstead ofpython. On Mac/Linux, usepython3. - PATH issues: If Windows says Python isn’t recognized, rerun the installer and make sure "Add Python to PATH" is checked.
- Shell vs. Python confusion: If you see a prompt like
$,%, orC:\>, you're in the system shell—run commands likepython --versionthere. If you see>>>, you're inside Python—run Python code likeprint("Hello, Python!")there. Mixing them up is a common beginner mistake. - Still stuck? Restart your computer. If problems persist, uninstall and reinstall Python from the official site.
For more troubleshooting, see Common Python Errors for Beginners.
What’s Next? Start Writing Code
With Python installed, you’re ready to write your first program. You can use any text editor, but beginner-friendly options are covered in Python IDEs and Editors for Beginners.
When you’re ready to run your code, check out How to Run Python Code: Scripts, Interactive Mode, and More.
Recap: The Builder’s Checklist
- Check if Python is already installed.
- Download Python from python.org.
- Install and add to PATH (Windows).
- Use your package manager on Linux.
- Verify with
python --versionorpython3 --version. - Run the Python shell and print something.
Installing Python is not ceremony—it’s the first lever you pull as a builder. When you see the >>> prompt and print your first line, you’ve turned your computer into a tool for building, not just browsing.
Your Next Step
Open your editor, write a simple Python script, and run it. The journey from installation to automation starts with one working command.
Want a more structured Python path?
Use the Python Starter Pack to turn scattered tutorials into a focused practice path.
Python Starter Pack
A compact LearnPyFast PDF pack covering what Python is, installation, your first program, running Python code, and Python versions.
- 5 curated chapters
- Enhanced PDF edition with bundle-only learning guidance
- Offline-friendly format for focused review
- Source article links for future online updates
Coming soon
