The PyGame project now ships just such wheels for a variety of Python versions on Mac, Windows, and Linux, which removes a whole huge pile of complexity both in generally understanding the C toolchain and specifically understanding the SDL build process. This will also install Pygame. Pre-compiled Pygame packages are available to pip for Windows & Linux (32-bit and 64-bit), and for Mac OS (64-bit only). If you have a different system, you’ll need to find a way to install pygame first. Browse other questions tagged pygame or ask your own question. The Overflow Blog Making the most of your one-on-one with your manager or other leadership.
- Pygame is a Free and Open Source cross-platform library for the development of multimedia applications like video games on Python. It uses the Simple DirectMedia Layer library and several other popular libraries to abstract most common functions and makes writing these program a more intuitive task.
- ACCESS the FULL COURSE here: Learn Python 3.6 from scratch while creating your own 'Frogger' style game!.
Python3 and Pygame on macs can have a special setup. Try and follow the instructions on here, if you have the newest macOS. Make sure to follow the instructions designated for Python3. If those instructions don't work, click the source link on that answer, which goes to an article made for older macs.
Python 3 + VirtualEnv + HighSierra + Pygame 1.9.x (Dev-Dec21) + Xcode 10.1 + Homebrew¶
1. Install Homebrew -- instructions found on link.Install the SDL dependencies: 2. Install XQuartz3. Install Python 3.7.x 4. Make VirtualEnv5. Install Pygame (Dec 21 snapshot from development) or you may try latest. If you get latest -- run tests to verify all is working.
Dec21st Latest (all tests verified)
Latest from GIT REPO
6. verify all Pygame Tests Homebrew is a package manager that's very popular on Mac. We use that to get the dependencies for pygame.
If you want to install the last release, change the pip install part to: Other instructions¶
The following page details how to install PyGame 1.9.1 on a Mac OS X 10.6 (Snow Leopard) running the most recent 2.x version of Python (2.7.1).
Here are some alternative methods for installing PyGame on osx:
- An alternative method based on macports and SVN
- I recently installed PyGame 1.9.1 on Mac OS X 10.6 (Snow Leopard) running Python 3.1 - (instructions at the bottom of the page. Cheers, and good luck! (Paul Barry, Dec 2009).
- A method of installing pygame on Mac OS X 10.7 (Lion)
- Here's how I installed PyGame 1.9.1 on Mac OS X 10.6 (Snow Leopard) for Python 2.7.2.
Mountain Lion install instructions¶
Snow leopard install instructions.¶
Download Pygame For Pycharm Mac
Set these environment flags before building...
If you get this error:
This link has a solution: http://packetcloud.net/2009/09/22/installing-mysql-python-module-for-python-262-on-snow-leopard-using-xcode/
first, get the following packages:
- The most recent PyGame from this site (currently 1.9.1): http://pygame.org/download.shtml
- The most recent PyObjC, (currently 2.2) Try `easy_install pyobjc2.2` in terminal or download from the pyobjc site if that doesn't work - (Not needed in Mac OSX 10.5 Leopard - pyobjc 2.0 comes preinstalled)
- http://www.ijg.org/files/jpegsrc.v6b.tar.gz <-- BROKEN LINK !! ??
SDL frameworks
Tested with the latest python 2.7.x (2.7.1) framework:
Install the SDL Frameworks¶
Open the DMG files and read the included Readme files to determine what needs to be moved where. The normal process is to go to each opened volume (/Volumes/SDL_something) directory, and run the appropriate following command:
Install pyobjc (non-Leopard only)¶
Unpack the tgz
Build and install Install Numeric¶
![Mac Mac](/uploads/1/3/3/6/133688366/344928492.jpg)
Unpack the tgz
In OSX Leopard, you will need to comment out three lines (152-154) in /Packages/RNG/Src/ranf.c Build and install Install Universal build libjpeg & libpng¶
pygame needs universal binaries to build right, but libpng and libjpeg sources don't build as universal binaries automatically... so you probably want to download the pre-built universal binaries for libpng & jpeg from ethan.tira-thompson.com. However you probably don't want to build against the dylib's for libpng and libjpeg if you are making an installer or will be using py2app, because then your distribution's imageext.so will not work without your clients also installing the libjpeg and libpng pacakges.
Since the package above installs both dylib and .a versions to /usr/local/lib and the build process will use the dylib versions by default, this means you probably want to delete/rename the dylib versions
Since the package above installs both dylib and .a versions to /usr/local/lib and the build process will use the dylib versions by default, this means you probably want to delete/rename the dylib versions
Install the package
Install libjpeg (from source)¶
Skip this step if you downloaded the pre-built universal binaries for libpng & jpeg
Unpack the tgz
Build and install Install libpng (from source)¶
Skip this step if you downloaded the pre-built universal binaries for libpng & jpeg
Unpack the tbz
Build and install
Install pygame¶
Unpack the tgz
Configure
The output should be: Edit Setup and put a '#' at the start of the line:
Build pygame Install pygame Enjoy!¶
Here are working easy instructions for building pygame from source with homebrew on Mavericks and Mountain lion.
pygame with sdl2¶
Experimental sdl2 support can be compiled in like so:
Mon, Sep 28, 2015Tags: pythonpygametutorial
Making games is a great way to improve your programming skills while making something fun at the same time. Pygame is a set of tools for Python that make it easy to work with graphics and sound.
Unfortunately, installing Pygame is not as easy as using it is. Below you’ll find the best directions we’ve found for getting it working on your system. Follow the directions below, and let us know in the comments below if you have any problems.
Note: For most of these instructions you will need to use the command line. Don’t be intimidated - programmers work on the command line all the time. Once you get used to it, you’ll find it’s the quickest and easiest way to do lots of useful things on the computer.
You access the command line by running the Terminal application - click on the Spotlight icon and type “terminal” to find it.
Step 1: Install XCode command line tools
XCode is the tool from Apple for creating Mac and iOS applications. It can be installed from the App Store (it’s free). When it’s finished, type the following at the command line:
Step 2: Install Homebrew (http://brew.sh)
Homebrew is a tool to easily install all kinds of software from the command line. It saves you having to go to a bunch of different sites and download lots of individual installers. Copy and paste this on the command line:
![Mac Mac](/uploads/1/3/3/6/133688366/275144636.png)
and follow the directions. You’ll also need to install Homebrew Cask (http://caskroom.io):
Step 3: Install the rest of the software
Now we can start installing all the requirements for Pygame. Just type the following commands one at a time and let the computer do its thing:
Step 4: See if it works!
Now we can see if it works. Run Python from the command line:
and try loading Pygame:
If you don’t see an error message, you’re all set! Now head over to our YouTube Channel and start coding!
Important
You will not be able to use Pygame from IDLE. You will need to run your programs from the command line like this:
Some code editors will also let you run Python programs from inside the program, but we’ll talk about that in a separate post.
Step 1: Install Python
If you haven’t already, go to http://python.org/ and download the latest Python installer. Click on “Downloads” and choose “Download Python 3.5.0” (or whatever the latest version is).
When the download finishes, choose “run” - you may need to open your Downloads folder and double-click on the installer file.
Check the box labeled “Add Python 3.5 to PATH” and then click “Customize Installation”. Under “Optional Features” make sure all the boxes are checked. Under “Advanced Options” you can leave it as-is. Then click the Install button and let the computer complete the process.
Step 2: Install Pygame for Windows
Click here and download the appropriate installer for your computer. For most people, this will be the latest 32-bit installer, for example:
Choose “Save” and let the file download.
Now, you need to go to the command line. In your Start Menu search for “command” and you’ll see a button for “Command Prompt”.
Type the following:
Step3: See if it works!
Now we can see if it works. Run Python from the command line:
and try loading Pygame:
Python Pygame Download Mac
If you don’t see an error message, you’re all set! Now head over to our YouTube Channel and start coding!