Python mac os中的pygame安装问题
我有以下安装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
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
包含在src/\u numericsurfarray.c:23中的文件中:
src/pygame.h:106:10:致命错误:“未找到SDL.h”文件
#包括
^
生成1个错误。
错误:安装程序脚本退出,错误为:命令“gcc”失败,退出状态为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 install 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
似乎就足够了,但我想有些部分将无法工作。