Python mac os中的pygame安装问题

Python mac os中的pygame安装问题,python,pygame,Python,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 s

我有以下安装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 python版本-python 2.7.5::Anaconda 1.6.1 x86_64
如有任何建议,将不胜感激?谢谢

我的系统也是OSX10.9.2,我也遇到了您的问题,我还在尝试一些; 也许这会对你有所帮助:

有一些步骤:

1.Install [Quartz](https://xquartz.macosforge.org/landing/);
2.Install Xcode-Command-Line,
  but you may cant install it by `xcode-select --install`,
  so you can down from 
  https://developer.apple.com/downloads/index.action ;
  I suggest you setup xcode,and this really solute my some problem;
3.`brew tap homebrew/headonly`
  `brew install smpeg --HEAD`
  `brew install sdl sdl_image sdl_mixer sdl_ttf portmidi`

4. `sudo pip install hg+http://bitbucket.org/pygame/pygame`;
   if you clone this repo and try `python setup.py install`,you may meet some weird problem;
我尝试安装了基于pygame的kivy,我尝试了很多次,但只成功安装了一次pygame,然后我卸载了它,也无法安装

有些人提到:

=======更新


现在我已经成功安装了pygmae,请记住您应该安装xcode,而不仅仅是xcode命令行

我可以通过以下方式安装OSX Mavericks:

brew install sdl sdl_image sdl_mixer sdl_ttf portmidi
pip install https://bitbucket.org/pygame/pygame/get/default.tar.gz
默认分支现在正在提交e3ae850

资料来源:


还可以看到另一个StackOverflow问题:

我使用以下方法在Mac OSX 10.14.4上安装了pygame:

brew安装sdl sdl_图像sdl_混合器sdl_ttf端口MIDI sudo-H pip3.8安装pygame

这是我的工作:

如果您没有通过自制程序安装Python/pip,您使用的是系统安装的Python,那么您可能需要运行sudo pip3 install pygame

在运行pip3 install pygame之前,我还为XCode以及XQuartz安装了命令行工具,并安装了以下自制软件包:brew安装sdl sdl_image sdl_mixer sdl_ttf smpeg portmidi

如果自制无法安装smpeg,您可能需要执行以下操作:

brew tap自制/仅限人头 brew安装-头smpeg


来源:

我也有同样的问题。我尝试了这个问题的所有答案,包括pip和pip3的变体。最后,对我有用的是:

sudoeasy_安装pygame


但是,请注意:1表示easy_install已被弃用,并建议使用pip。2 pygame安装在旧的标准python 2.7文件夹中,而不是我刚刚安装的python 3.8.3中-尽管我能够在VSCode中成功地使用它。

这可能会有所帮助。.按照建议的src/pygame运行brew命令后出现以下错误。h:106:10:致命错误:“未找到SDL.h”文件包括^1错误生成。错误:安装程序脚本退出,错误为:命令“gcc”失败,退出状态为1请不要仅发布一个链接以获取您的答案-如果该博客出现故障,您的答案将不再有用。在你的答案中加入相关步骤,并使用博客作为支持。对不起,这是我的第一个答案,我现在将更改它!只需brew安装sdl似乎就足够了,但我想有些部分将无法工作。