python安装pygame无法找到SDL.h文件

来源:互联网 发布:笔记本风扇反转软件 编辑:程序博客网 时间:2024/06/02 02:28

博主最近自学python,在引入pygame时出现无法找到SDL.h 文件,各种搜索后,在stackOverFlowO找到答案

这是问题,无法找到文件

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

解决方法

brew install sdl sdl_image sdl_mixer sdl_ttf portmidi
在终端执行上面的命令

然后执行下面的插入命令

pip install https://bitbucket.org/pygame/pygame/get/default.tar.gz

如果是python3 记得使用pip3 插入pygame

放原链接:阅读原文