CoursePython from Scratch to Intermediate · Course guide · part 6 of 75
Part 6 · Course guide

Running Python on Your Own Computer

7 min read·14 Oct 2026

Colab is enough for the whole course. This page is for when you want Python on your own machine: to try the interactive prompt in a terminal, to run scripts the way working programmers do, and to build the Booknook repository in a real folder with a virtual environment. It is the one run-locally page for the course; Module 1 Lesson 2 and Module 7 Lesson 4 point here.

None of the steps on this page can run inside a Colab notebook. The macOS steps were run on 14 October 2026 with Python 3.12.15 and the outputs shown come from that run. The Windows and Linux steps were not run; they follow Python's own documentation ("Using Python on Windows" at docs.python.org) and the package pages named below.

1. Which Python to install

Install Python 3.12. It is the version Colab runs, so every output in the course will match yours exactly. Any newer version (3.13, 3.14 and later) also runs all the course code, because the course uses nothing that later versions removed; the main difference you will notice is the interactive prompt (section 4).

One thing to know before you download: 3.12 is now in its "security fixes only" stage. Python's website still lists new 3.12 releases, but for those it publishes only the source code, not a ready-to-run installer. The last 3.12 release with installers for Windows and macOS is 3.12.10, and that is a fine version for this course. The routes below get you a working 3.12 either way.

2. Install it

Windows

The Python team's recommended route on Windows is the Python install manager.

  1. Install it from the Microsoft Store (search for "Python install manager") or from python.org/downloads.
  2. Open PowerShell (press the Windows key, type powershell, press Enter).
  3. Install 3.12:
text
py install 3.12
  1. Check it:
text
py -V:3.12 --version

py is the install manager's command. -V:3.12 picks version 3.12 when you have more than one. On Windows, wherever this page says python3.12, type py -V:3.12 instead.

The older route, the full installer from the Python 3.12.10 release page, also works. If you use it, tick Add python.exe to PATH on the first screen; without it, the terminal cannot find Python.

macOS

Either download the macOS 64-bit universal2 installer from the Python 3.12.10 release page and double-click it, or, if you already use the Homebrew package manager:

text
brew install python@3.12

Linux

Ubuntu 24.04 LTS already comes with Python 3.12 as python3. You need one more package to make virtual environments:

text
sudo apt install python3-venv

Other Linux systems: install python3.12 with your system's package manager.

3. Open a terminal and check

A terminal is a window where you type commands instead of clicking. On macOS, open Terminal (in Applications, then Utilities). On Windows, use PowerShell. On Linux, your desktop has a Terminal application.

Type this and press Enter (Windows: py -V:3.12 --version):

text
python3.12 --version

You should see

text
Python 3.12.15

The last number may be different (3.12.10, for example). Anything starting 3.12 is right.

4. The interactive prompt

Type python3.12 on its own (Windows: py -V:3.12) and press Enter. The prompt changes to >>>: Python is now waiting for one line at a time and answers each one straight away. This is the REPL (read, evaluate, print, loop), taught in Module 1 Lesson 2.

text
>>> 2 + 3
5
>>> print("Hello from the Booknook shelf")
Hello from the Booknook shelf
>>> exit()

exit() leaves the prompt and gives you the terminal back. Python 3.13 and later have a newer prompt, with colour and easier multi-line editing, where exit also works without the brackets. Python 3.12's prompt is plainer. Lessons say which one a figure shows.

5. A code editor

You can write Python in any plain-text editor, but a code editor colours the code, shows mistakes as you type, and runs files with one click. Two free choices:

EditorGood forGet it
Visual Studio CodeThe editor most working programmers use; grows with youcode.visualstudio.com, then install the Python extension from Microsoft inside it
ThonnyComplete beginners; simple and unclutteredthonny.org

In VS Code, open a folder with File, then Open Folder, and choose your Python with Python: Select Interpreter from the Command Palette (Ctrl+Shift+P, or Cmd+Shift+P on a Mac).

6. Run a script

A script is a file of Python code that runs from top to bottom. Make a folder for the course, create a file in it called hello.py in your editor, and put this one line in it:

text
print("Hello from a script")

Save it. In the terminal, move into that folder with cd (for example cd Documents/booknook-course) and run:

text
python3.12 hello.py

You should see

text
Hello from a script

This is exactly what %%writefile hello.py followed by !python hello.py did in Colab (02-setup-colab.md, section 5): the first writes the file, the second runs it.

7. The project folder and a virtual environment

From Module 7 you build one project, booknook. A virtual environment (venv) is a private copy of Python for one project, with its own installed packages, so that one project's packages never break another's. Module 7 Lesson 4 explains why; these are the steps.

Make the folder and move into it:

text
mkdir booknook
cd booknook

Create the virtual environment, in a folder called .venv:

text
python3.12 -m venv .venv

Activate it, which tells this terminal to use the project's private Python:

SystemCommand
macOS and Linuxsource .venv/bin/activate
Windows (PowerShell).venv\Scripts\Activate.ps1

The prompt now starts with (.venv). While it does, python means the project's Python, whatever version number you typed to create it:

text
(.venv) $ python --version
Python 3.12.15

To leave the environment, type deactivate. Activate it again each time you open a new terminal for the project.

On Windows, if PowerShell says running scripts is disabled, run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned once, answer Y, and activate again.

8. Install packages with pip

pip installs packages from PyPI, the Python Package Index. The project's requirements.txt (written in Module 7) lists the one package it needs, with its version pinned:

text
pytest==9.1.1

With the environment active, install everything listed in it:

text
python -m pip install -r requirements.txt

Then see what is installed:

text
python -m pip list

The list includes pytest 9.1.1 and the few small packages pytest needs (and pip itself). Always type python -m pip, not just pip: it guarantees the package goes into the Python you are actually using.

9. Run the tests and the tool

From Module 10, with the environment active and the terminal in the booknook folder:

text
python -m pytest -q

pytest finds every file in tests/ whose name starts with test_, runs the tests in it, and prints a dot for each one that passes and a summary line such as 15 passed. Module 10 Lesson 4 explains the output.

From Module 11, the finished tool runs the same way:

text
python -m booknook report

10. From notebook cells to your own computer

In ColabOn your own computer
%%writefile booknook/fees.py and the codeCreate booknook/fees.py in your editor and paste the code in
%%ensure booknook/fees.py in a labThe same, but only if you do not have the file already. Never replace your own work
!python hello.pypython hello.py in the terminal
%pip install -q pytest==9.1.1python -m pip install -r requirements.txt inside the venv
%cd booknookcd booknook
The catch-up cellNot needed: your files stay where you saved them
input() shows a box under the cellinput() waits for you to type in the terminal

11. When something goes wrong

What you seeWhat it meansWhat to do
'python3.12' is not recognized (Windows)Windows uses a different commandUse py -V:3.12 instead
command not found: python3.12 (macOS, Linux)3.12 is not installed, or is under another nameCheck with python3 --version; if that says 3.12, use python3
No module named pytestpytest went into a different Python, or the venv is not activeActivate the venv (look for (.venv)), then python -m pip install -r requirements.txt
ModuleNotFoundError: No module named 'booknook'The terminal is not in the project foldercd into the outer booknook folder, the one that holds data/ and tests/
Activate.ps1 cannot be loaded because running scripts is disabledA Windows safety settingSee the note at the end of section 7
Your output differs from the lesson'sUsually a different Python version, or a cell's code that changedCheck python --version; then compare your code with the lesson's line by line

The next step after this course is version control with Git, which keeps the history of every change to the repository. It is not covered here; Module 1 of the AI Engineering course has a lesson on it.