▦ MATRIX THINKING

START HERE

Your first
working window.

Set up the environment, run three small checks, then start Module 0.

The examples were checked with Python 3.13.7, NumPy 2.5.3 and Pygame 2.6.1. These are the book’s tested versions, not a claim about the latest releases.

1. Get the tools and code

Install 64-bit Python 3.13 for the book’s Windows setup. Use PyCharm as described in the book, or another editor. Download and extract the full companion ZIP before running files.

Open the extracted Matrix_Thinking-main folder as your project. Keep the resource folders with the programs.

2. Use a project environment

In PyCharm, select a project-specific virtual environment using Python 3.13. In its terminal, from the repository root, install:

python -m pip install -r getting_started/requirements.txt
Windows terminal alternative

From the extracted repository folder:

py -3.13 -m venv .venv
.venv\Scripts\python.exe -m pip install -r getting_started/requirements.txt
.venv\Scripts\python.exe getting_started/hello.py
.venv\Scripts\python.exe getting_started/check_libraries.py
.venv\Scripts\python.exe getting_started/check_window.py

Calling the environment’s Python directly avoids changing PowerShell activation policies.

macOS / Linux terminal alternative

With Python 3.13 installed, from the extracted repository folder:

python3.13 -m venv .venv
.venv/bin/python -m pip install -r getting_started/requirements.txt
.venv/bin/python getting_started/hello.py
.venv/bin/python getting_started/check_libraries.py
.venv/bin/python getting_started/check_window.py

The book’s installation screenshots show Windows.

3. Run the checks in order

  1. hello.py prints a greeting, 5, and the literal text 2 + 3.
  2. check_libraries.py checks the imports.
  3. check_window.py prints a 2×3 array and opens a blue window. Close the window to finish.

In PyCharm, open each file in getting_started/ and run it with the project interpreter.

Open setup files and instructions ↗

If something goes wrong

ModuleNotFoundError
Install the requirements into the same interpreter that runs your file. Use that interpreter’s -m pip.
Python cannot be found
On Windows, check py -3.13 --version. In PyCharm, select the interpreter explicitly.
A resource is missing
Extract the whole repository. Follow the module README’s working directory and launch command.

4. Follow the modules

Run each listing separately. Steps are complete intermediate programs, not fragments to concatenate. Try exercises before reading their solutions.

Explore modules 0–23 →

Official references: Python virtual environments · NumPy installation · Pygame setup