Installing a working Pygame on macOS
I found that the simplest way to get hello.py
to run on macOS was to use Anaconda for the python environment, and then install pygame with pip
.
conda create -n pygame python=3.8
conda activate pygame
pip install pygame
Even though using pip in this way within a Conda environment is not recommended, it seems to be okay in this case, because the pygame package is not offered in Anaconda's package archives.
Why use conda, then?
Well, I tried to install pygame through pipenv/pip (using an ASDF-managed python), but this does not work well on a Macintosh. The hello.py
program runs and launches the pygame, sort-of (I see it in the Dock), but no window is displayed.
I think that there is a Macintosh Framework issue getting in my way when using the ASDF-managed environment. Conda fixes this issue, whatever it is, and running from the conda env just works.
See Anaconda's page about pip for more detail on the cautions with pip in conda environments. For this project, it should be fine.