To get started with Python, install the latest version from python.org (or your system’s package manager), check it with python --version, and run a script by saving code in a .py file and typing python hello.py in a terminal. On macOS and Linux, the command is usually python3.

Every Python tutorial assumes Python is already installed and working, and that’s exactly where many beginners get stuck: the command isn’t found, the wrong version runs, or Windows opens the Microsoft Store instead. This guide walks you through installing Python on Windows, macOS, and Linux, running code in the interactive shell, writing and running your first script, and fixing the errors you’re most likely to see.

It’s the first step of the Learn Python course. Once Python works, continue with Python Basics: What Every Beginner Should Know.

Which Version Should You Install?

Install the latest stable version of Python 3. At the time of writing, that’s Python 3.15, released in October 2026. Each version gets about five years of security updates, so any recent version (3.12 or newer) works for this course. Avoid Python 2: it reached end of life in 2020, and modern code and libraries don’t support it.

Install Python on Windows

The recommended way to install Python on Windows is now the Python install manager, available from python.org/downloads and the Microsoft Store.

  1. Download and run the Python install manager.
  2. Open Windows Terminal or PowerShell and install the latest version:
py install default
  1. Check that it worked:
py --version
python --version

The install manager also lets you keep several versions side by side: py list shows what’s installed, py install 3.14 adds a specific version, and py -V:3.14 runs it. After installing, the plain python command runs your newest version.

You may still see the traditional installer (a .exe file) recommended in older tutorials. If you use it, check “Add python.exe to PATH” on the first screen; skipping that box is the most common reason python “isn’t recognized” afterward.

Watch out for the Microsoft Store shortcut. On a fresh Windows computer, typing python may open the Microsoft Store instead of running Python. That’s an “app execution alias.” Either install Python as above, or turn the alias off under Settings > Apps > Advanced app settings > App execution aliases.

Install Python on macOS

macOS may include an older Python for its own tools, but don’t rely on it. Install a current version one of two ways:

brew install python

Then check the version. On macOS, the command is python3:

python3 --version

Install Python on Linux

Most Linux distributions already include Python 3. Check with python3 --version. On Ubuntu and Debian, install the extra pieces you’ll need for this course:

sudo apt update
sudo apt install python3 python3-venv python3-pip

python3-venv lets you create virtual environments, which you’ll use to install packages. Your distribution’s Python may be a version or two behind the newest release, which is fine for learning. If you need the very latest, the uv tool can install any Python version with uv python install.

python, python3, or py?

SystemCommand
Windowspython or py
macOSpython3
Linuxpython3

This guide writes python; type python3 on macOS and Linux. The same applies to pip: use python -m pip (or python3 -m pip) so you always get the pip that belongs to the Python you’re running.

Try the Interactive Shell

Type python (or python3) with nothing after it to open the interactive shell, also called the REPL. The >>> prompt runs each line as soon as you press Enter, which is perfect for quick experiments:

>>> 2 + 3
5
>>> "python".upper()
'PYTHON'
>>> exit()

Type exit() or press Ctrl+D (macOS and Linux) or Ctrl+Z then Enter (Windows) to leave.

Write and Run Your First Script

The shell forgets everything when you close it. For real programs, save your code in a script: a text file ending in .py.

  1. Create a folder for your projects, like python-projects.
  2. Open it in a code editor. Visual Studio Code with the Python extension is a great free choice.
  3. Create a file named hello.py with this code:
name = input("What's your name? ")
print(f"Hello, {name}! Python is working.")
  1. Open a terminal in that folder and run it:
python hello.py
What's your name? Maria
Hello, Maria! Python is working.

input() waits for you to type and press Enter, and print() shows the result. The f before the quotes makes it an f-string, which inserts the value of name into the text.

If you get can't open file 'hello.py': No such file or directory, the terminal isn’t in the folder where you saved the file. Use cd to move there first, or run python path/to/hello.py. In VS Code you can also click the Run button in the top-right corner, which uses the integrated terminal.

Installing Packages

Python comes with a large standard library, and thousands more packages are available from the Python Package Index (PyPI). Install them inside a virtual environment for each project:

python -m venv .venv
source .venv/bin/activate      # macOS and Linux
.venv\Scripts\activate         # Windows
python -m pip install requests

On recent versions of macOS (with Homebrew) and Linux, installing packages globally with pip fails with an “externally-managed-environment” error. That’s on purpose: it protects the system’s own Python. A virtual environment is the fix, and it’s a good habit anyway. See the virtual environments guide for the details.

Common Problems and Fixes

ProblemFix
'python' is not recognized (Windows)Install with the install manager, or rerun the traditional installer and check Add python.exe to PATH. Then open a new terminal.
python opens the Microsoft StoreInstall Python, or turn off the alias in App execution aliases.
command not found: python (macOS/Linux)Use python3.
The wrong version runsCheck with python --version. On Windows, py list shows every installed version.
No such file or directorycd into the script’s folder first.
externally-managed-environmentCreate and activate a virtual environment, then install.
pip installs to a different PythonUse python -m pip install ... instead of pip install ....

Frequently Asked Questions

Is Python free?

Yes. Python is free and open source, for personal and commercial use.

Should I install Anaconda instead?

Anaconda bundles Python with hundreds of data science packages. It’s convenient for data analysis, but large. For learning Python in general, the standard installer plus virtual environments is lighter and teaches you the tools most projects use.

Can I have more than one version installed?

Yes. On Windows, the install manager handles several versions at once (py install 3.14, then py -V:3.14). On macOS and Linux, tools like uv can install and switch between versions per project.

Do I need to uninstall the Python that came with my Mac or Linux system?

No, and you shouldn’t. The operating system may depend on it. Install your own version alongside it.

Conclusion

Installing Python takes a few minutes: use the install manager on Windows, the python.org installer or Homebrew on macOS, and your package manager on Linux. Check the version, try a few lines in the interactive shell, and run your first .py script from a terminal. With that working, you’re ready for the rest of the course, starting with Python Basics: What Every Beginner Should Know.