Module 01

So you want to install Python

This module gets you from “I honestly have no idea what is on this machine” to “I can open a terminal and prove Python is actually ready.”

Estimated time: 20 to 30 min Prerequisite: none

Why this matters for biology research

Many image-analysis tutorials start in the middle, assuming Python already works. In practice, the first blocker is usually much simpler: knowing which Python you are running and whether your computer can find it from the terminal.

Once Python is installed locally, you can build reproducible workflows for microscopy analysis, notebooks, napari plugins, and small analysis scripts that are easier to revisit months later.

Learning goals

  1. Install a recent Python version on your operating system.
  2. Open a terminal window without needing administrator magic.
  3. Check that python or python3 works.
  4. Understand where to go next if the command is not found.

Suggested pacing

This module can easily be split across two short study blocks. One session can focus on installation and opening a terminal. A second session can focus on verification and troubleshooting.

Recommended mindset

Treat this as infrastructure, not as a test. If one command does not work, that does not mean you did anything wrong. It usually means your system uses a slightly different command name or your PATH has not updated yet.

Step 1: install Python

The details depend on your operating system, but the shared goal is simple: get one reliable Python installation that your terminal can find.

Windows

Download Python from the official Python website and run the installer. During installation, check the option to add Python to your PATH if the installer shows it.

Windows notes

  • You may end up using py even if python does not work.
  • PowerShell is a perfectly fine terminal for the rest of the course.

macOS

Install Python from the official installer or from a package manager you already trust. If your lab or institution has a preferred setup route, use that route consistently across the course.

macOS notes

  • python3 is often the better first command to try.
  • Your system may already include another Python that is not meant for your coursework.

Linux

Many Linux systems already ship with Python, but you may still want a current user-facing version. Check what is available first, then install through your distribution package manager if needed.

Linux notes

  • It is common for the system to already depend on Python internally.
  • Document what install path you used so you can repeat it later.

Step 2: verify the install

Open a terminal, then try these commands one at a time:

python --version
python3 --version
py --version

On Windows, py is often available. On macOS or Linux, python3 is common. One of these should print a Python version instead of an error.

How to interpret the response

  • A printed Python version means the shell can find that command.
  • A “command not found” message means the install may exist but your shell cannot see it yet.
  • An unexpected old version usually means more than one Python is installed.

Example outputs

$ python3 --version
Python 3.11.9

$ py --version
Python 3.12.3

$ python --version
zsh: command not found: python

Step 3: test that Python runs code

python
print("hello from Python")
exit()

If python does not start the interpreter, repeat the test with python3 or py.

This step matters because it confirms not just that Python exists, but that you can actually run code with it from the terminal.

One-line alternative

If you do not want to enter the full interpreter yet, you can ask Python to run a single command directly from the shell:

python -c "print('hello from Python')"
python3 -c "print('hello from Python')"
py -c "print('hello from Python')"

One of those should print the text and return you to the shell immediately.

Common problems

  • Command not found: reopen the terminal and try again. If it still fails, Python may not be on your PATH.
  • Unexpected old version: your system may have multiple Pythons installed. That is common and not fatal.
  • Permission issues: prefer a user install or a package manager route instead of forcing a system-wide install.

Mini glossary

  • Terminal: a text-based interface for running commands.
  • PATH: the list of places your shell looks for commands.
  • Interpreter: the program that reads and runs Python code.

Very first Python commands to try

Once Python starts successfully, try a few tiny commands so the interpreter stops feeling mysterious:

print("microscopy")
2 + 2
sample_name = "control_01"
print(sample_name)

Then exit with exit() or by pressing Ctrl-D on macOS/Linux.

Stop here for today if needed

A good stopping point is when one version command works and you know which command name your machine uses. Write that command down before you stop so you can resume quickly later.

Checklist before moving on

  • You can open a terminal window.
  • A version command prints a Python version.
  • You can enter and exit the Python interpreter.
  • You know whether your machine uses python, python3, or py.