When Sean McManus’s – Mission Python: Code a Space Adventure Game was first released I wrote a blog post on how to setup macOS to use the book.
Below are the updated steps for macOS 12.0 (Monterey) and the latest version on Python and Pygame Zero.
macOS 12.0 (Monterey) ships with Python3 but I would still recommend installing a second version as not to “upset” the OS native shipped version.
The book recommends Python 3.6.6 (at time of writing), I have based this post on Python 3.10.0 (which is the latest version at the time of me writing this).
Install Python 3.10.0
Download Python 3.10.0 from https://www.python.org/downloads/mac-osx/
Double click the installer and follow the on-screen instructions.
Once installed Open Terminal (Cmd+Spacebar, type Terminal, press Enter).
- Type which python3, at the prompt
You should get the below result-
/Library/Frameworks/Python.framework/Versions/3.10/bin/python
Install pip3
pip3 is installed with python, I would recommend updating it to the latest version (21.3.1) at the time of this writing, in Terminal>
- Type pip3 install --upgrade pip - Type pip3 --version
You should get the below result-
pip 21.3.1 from /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip (python 3.10)
Install Pygame Zero
In Terminal>
- Type pip3 install pgzero - Type pip3 show pgzero
You should see the below in the results-
Name: pgzero
Version: 1.2
Once the above has been completed, you are ready to test Mission Python on your Mac.
Download the Mission Code file from https://www.sean.co.uk/books/mission-python/index.shtm
Once the file has downloaded and unzipped from within Terminal move to the escape folder (I unzipped the into my Downloads folder to test).
- Open Terminal (Cmd+Spacebar, type Terminal, press Enter).
- Type cd Downloads
- Type cd escape
- Type pgzrun escape.py
Once you have done the above the game should start. You are now ready to begin your adventure with Mission Python.