Installing Pygame on Mac 10.11.6

As the title suggests I am having trouble installing pygame on my Mac. I've tried a lot different solutions. Such as using the steps in Python Crash Course to looking on stack overflow.

I've tried:

and I receive error in pip no matter which technique I use.

In the IDE i'm using which is spyder I get this error:

ModuleNotFoundError: No module named 'pygame'

Any help would be massively appreciated!

Thank you in advance :)

1 Answer

You see the error

ModuleNotFoundError: No module named 'pygame'

because the Python version you are running in your IDE cannot detect te pygame module you installed.

Homebrew Python

A clean way to install and use Python packages on MacOS is to

  1. Install Homebrew -
  2. Install Python using Homebrew

    brew install python

  3. In your IDE, set Python's Site-Packages with the PYTHONPATH environment variable, for example for Python 3.7.x, set it to /usr/local/lib/python3.7/site-packages

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like