Installing PIP/pygame on macOS

I recently started to learn Python, and by recently, I mean I started mostly with it today. To get familiar with Python a friend showed me a simple tic-tac-toe tutorial which I saved in to a .py file and tried to run from the terminal. After fixing an error due to a / being inserted on a line-break, all went well, mostly, with the exception of getting the package installer for Python working (pip), and also getting pygame downloaded.

Running pip install pygame threw an error saying that pip wasn’t found.

I was sent a command by my friend to download get-pip.py using curl. The instructions are found here.

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

After downloading with curl you can then run:

python get-pip.py

This installs pip.

When done, I had to run the following command to install pygame:

python -m pip install pygame

This command is obviously different to the initial pip install pygame command earlier in the tutorial, and perhaps using the command pasted just above this paragraph would have worked all along. I certainly don’t know, but either way, it works now with the commands issued above.

Hopefully this helps you if you trip up on trying to get pygame setup.

Leave a comment