Home >Backend Development >Python Tutorial >Why Can't I Install Pygame on My Mac OS X and How Do I Fix the 'SDL.h' Error?

Why Can't I Install Pygame on My Mac OS X and How Do I Fix the 'SDL.h' Error?

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2024-12-28 01:38:13961browse

Why Can't I Install Pygame on My Mac OS X and How Do I Fix the 'SDL.h' Error?

Installation Error with Pygame on Mac OS

While installing the Pygame package, an issue arises with the following error:

fatal error: 'SDL.h' file not found

System Configuration

  • Operating System: Mac OS-10.9.2
  • Python Version: Python 2.7.5 :: Anaconda 1.6.1 (x86_64)

Resolution

On Mac OS (OSX Mavericks), the Pygame installation can be resolved using the following steps:

brew install sdl sdl_image sdl_mixer sdl_ttf portmidi
pip install https://bitbucket.org/pygame/pygame/get/default.tar.gz

Note that the current "default" branch of the Pygame Github repository is on commit e3ae850.

Refer to this StackOverflow discussion for more information: PyGame in a virtualenv on OS X with brew?

The above is the detailed content of Why Can't I Install Pygame on My Mac OS X and How Do I Fix the 'SDL.h' Error?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn