Install Pygame in MacOS
PyGame is a collection of modules that break through the language of Python applications. These modules are designed to edit video games. PyGame, therefore, includes computer graphics and audio libraries created for the use and language of Python programs.
At first, open the Terminal which is located at Applications -> Utilities -> Terminal and make sure that the Python3 is installed in your system. If it is not installed then type the below command.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
brew install python3
XCode: The first step for PyGame is to install Apple’s Xcode program. In your Terminal app, enter and run the following command to install XCode.
Be sure to click on all the verification recommendations that require XCode
We can now install the latest version of PyGame. Type the following command in Terminal and press Enter.
pip3 install pygame
To test if PyGame has been installed on your Mac, open terminal and type python, and import pygame as follows
If you don’t see any errors, it means that PyGame has been successfully installed on your Mac.