Pygame 找不到包含文件“sdl.h”
我正在尝试在 Windows 上构建一个使用 Pygame 的下载的 Python 应用程序。 我已经安装了Python 2.5和Pygame 1.7.1。 我是 Python 新手,但我只是尝试在 Windows 控制台命令行上输入顶级 .py 文件的名称。 (我使用的是 Win XP Pro。)
这是我收到的消息。
C:\Python25\include\pygame\pygame.h(68) : 致命错误 C1083: 无法打开包含 文件:'SDL.h':没有这样的文件或目录
我认为 Pygame 是在 SDL 之上构建的,并且不需要单独的 SDL 安装。 尽管如此,我安装了 SDL 1.2.13 并将 SDL include 文件夹添加到我的 %INCLUDE% 环境变量中。 还是没有运气。
我注意到 C:\Python25\Lib\site-packages\pygame 包含几个 SDL*.DLL 文件,但 python 树中的任何位置都没有 sdl.h 头文件。 当然,我可以将 sdl 头文件复制到 C:\Python25\include\pygame 文件夹中,但这是一个令人反感的想法。
有人知道设置的正确方法吗?
编辑: 该应用程序是“The Penguin Machine”pygame 应用程序。
I am trying to build a downloaded Python app on Windows that uses Pygame. I have installed Python 2.5 and Pygame 1.7.1. I am new to Python, but I just tried typing the name of the top level .py file on a Windows console command line. (I'm using Win XP Pro.)
This is the message that I get.
C:\Python25\include\pygame\pygame.h(68) : fatal error C1083: Cannot open include
file: 'SDL.h': No such file or directory
I thought that Pygame was built on top of SDL and that a separate SDL install was not necessary. Nevertheless, I installed SDL 1.2.13 and added the SDL include folder to my %INCLUDE% environment variable. Still no luck.
I noticed that C:\Python25\Lib\site-packages\pygame includes several SDL*.DLL files, but there is no sdl.h header file anywhere in the python tree. Of course, I could copy the sdl headers into the C:\Python25\include\pygame folder, but that is a distasteful idea.
Anybody know the right way to set things up?
EDIT:
The application is "The Penguin Machine" pygame app.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
发布评论
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我尝试编译并在我的 Linux 机器上遇到相同的错误:
似乎它尝试编译一个名为
surfutils
的扩展,它需要 SDL 开发标头。因此,我使用我的分发包管理器安装了
libsdl1.2-dev
包,它工作得很好。 您必须安装 SDL 开发标头才能为您的系统构建它。所以你的问题实际上是:如何在 Windows 上安装 SDL 开发标头,以及如何让程序使用它们?
好吧,我可以回答第二个问题。 您必须编辑 setup.py:
更改第 9 行。它说:
将此路径更改为您的 SDL 标头所在的位置,即:
给游戏开发人员留下一条说明,说明您遇到了此问题。 它可以提供一种在您的平台上查找 SDL 标头的更好方法。
I tried compiling and got the same errors on my linux box:
Seems like it tries to compile a extension called
surfutils
which needs SDL development headers.So I installed the
libsdl1.2-dev
package using my distribution package manager and it worked just fine. You must install SDL development headers in order to build it for your system.So your question really is: How do I install SDL development headers on windows, and how I make the program use them?
Well, I can answer the second question. You must edit setup.py:
Change line 9. It says:
Change this path to wherever your SDL headers are, i.e.:
Leave a note to the game developer to say you're having this trouble. It could provide a better way of finding SDL headers on your platform.