Mac OS中的Pygame安装问题
我有以下安装Pygame软件包的问题。
In file included from src/_numericsurfarray.c:23:
src/pygame.h:106:10: fatal error: 'SDL.h' file not found
#include <SDL.h>
^
1 error generated.
error: Setup script exited with error: command 'gcc' failed with exit status 1
系统信息
- Mac OS-10.9.2.2
- Python版本 - Python 2.7.5 :: Anaconda 1.6.1(x86_64)
有什么建议会非常感谢吗?谢谢。
I have following issue of installing pygame package.
In file included from src/_numericsurfarray.c:23:
src/pygame.h:106:10: fatal error: 'SDL.h' file not found
#include <SDL.h>
^
1 error generated.
error: Setup script exited with error: command 'gcc' failed with exit status 1
System information
- Mac OS-10.9.2
- python version- Python 2.7.5 :: Anaconda 1.6.1 (x86_64)
Any suggestion will be greatly appreciate ? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我也有同样的问题。我尝试了此问题的所有答案版本,包括PIP和PIP3的变化。最后,对我有用的人是:
sudo easy_install pygame
注意:(1) https://setuptools.readthedocs.io/en/latest/easy_install.html 说easy_install已弃用并建议使用pip。 (2)pygame安装在旧的标准Python 2.7文件夹中,而不是我刚刚安装的Python 3.8.3中安装 - 尽管我能够在VSCODE中成功使用它。
I had the same issue. I tried all versions of the answers to this question including variations of pip and pip3. Finally, the one that worked for me was:
sudo easy_install pygame
Note, however, that: (1) https://setuptools.readthedocs.io/en/latest/easy_install.html says that easy_install is deprecated and recommends using pip. (2) pygame is installed in the old standard python 2.7 folder rather than in the python 3.8.3 that I just installed -- though I was able to use it successfully in VSCode.
我的系统也是OSX10.9.2,我也遇到了您的问题,我仍然尝试一些;
也许这对您有帮助:
有一定步骤:
我尝试过安装kivy,它是基于pygame的kivy,我尝试了很多次,但是只需成功安装Pygame。 (
有些参考:
http://jamesfriend.com.au /安装pygame-python-mac-os-108-mountain-mountain-mountain-mountain-lion
http://juliaelman.com/blog/ 02/安装pygame-on-osx-mountain-lion/
==========
2013/04 / 呢
My system is also OSX10.9.2,and I also meet you problem,and I'm still try some;
Maybe this will be help for you:
there are some step:
I have try install kivy which is base on pygame and I try lots of times,but just success install pygame one time.Then I uninstall it and also can't install it ;(
some refer:
http://jamesfriend.com.au/installing-pygame-python-mac-os-108-mountain-lion
http://juliaelman.com/blog/2013/04/02/installing-pygame-on-osx-mountain-lion/
=======update
Now I have install pygmae sucess,remeber you should install xcode,not only xcode-command-line!
我设法在Mac OSX 10.14.4上安装PyGame,使用以下内容:
brew naster sdl sdl_image sdl_mixer sdl_ttf portmidi
sudo -h pip3.8安装pygame
I managed to install pygame on Mac OSX 10.14.4 using the following:
brew install sdl sdl_image sdl_mixer sdl_ttf portmidi
sudo -H pip3.8 install pygame
这项工作对我来说是:
如果您还没有通过Homebrew安装Python/Pip(您正在使用系统安装的Python),则可能需要运行&nbsp; sudo pip3 install pygame。
在运行之前&nbsp; PIP3安装PyGame,我还安装了Xcode的命令行工具)以及Xquartz,以及以下自制软件包:&nbsp; brew selplim sinst sdl sdl_image sdl_image sdl_mixer sdl_mixer sdl_tl_tttf smpeg portmidi。
如果Homebrew未能安装&nbsp; SMPEG;您可能需要执行以下操作:
Brew Tap Homebrew/headonly
brew install-head smpeg
来源: http:// jamesfriend.com.au/installing-pygame-python-mac-os-108-mountain-mountain-mountain-mountain-mountain-lion
This Work for me:
If you haven't installed Python/pip via homebrew (you're using the system-installed Python), you would likely need to run sudo pip3 install pygame.
Before running pip3 install pygame, I had also installed Command Line Tools for XCode), as well as XQuartz, and the following homebrew packages: brew install sdl sdl_image sdl_mixer sdl_ttf smpeg portmidi.
If homebrew fails to install smpeg you might need to do the following:
brew tap homebrew/headonly
brew install --HEAD smpeg
Source: http://jamesfriend.com.au/installing-pygame-python-mac-os-108-mountain-lion
这里(OSX Mavericks)我能够以这种方式安装:(
“默认”分支在提交 e3ae850 现在)
来源: https://bitbucket.org/pygame/pygame/pygame/pygame/pygame/issue/issue/139/sdlh-not-found -even-thought-it-exists#comment-3822470
也请参见其他stackoverflow问题: pygame在OS X上的Virtualenv中使用啤酒?
Here (OSX Mavericks) I got able to install this way:
("default" branch is on commit e3ae850 right now)
Source: https://bitbucket.org/pygame/pygame/issue/139/sdlh-not-found-even-thought-it-exists#comment-3822470
See this other StackOverflow question too: PyGame in a virtualenv on OS X with brew?