繁体   English   中英

mac os中的pygame安装问题

[英]pygame installation issue in mac os

我有以下安装 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)

任何建议将不胜感激? 谢谢。

在这里(OSX Mavericks)我能够以这种方式安装:

brew install sdl sdl_image sdl_mixer sdl_ttf portmidi
pip install https://bitbucket.org/pygame/pygame/get/default.tar.gz

(“默认”分支现在提交e3ae850

来源: https : //bitbucket.org/pygame/pygame/issue/139/sdlh-not-found-even-thought-it-exists#comment-3822470

请参阅另一个 StackOverflow 问题: PyGame in a virtualenv on OS X with brew?

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

须藤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 中成功使用它。

我的系统也是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 一次。然后我卸载它,也无法安装它;(

一些参考:

http://jamesfriend.com.au/installing-pygame-python-mac-os-108-mountain-lion http://juliaelman.com/blog/2013/04/02/installing-pygame-on-osx-mountain -狮子/

========更新

现在我已经安装了pygmae sucess,记住你应该安装xcode,而不仅仅是xcode-command-line!

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

brew install sdl sdl_image sdl_mixer sdl_ttf portmidi 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 homebrew/headonly brew install --HEAD smpeg

来源: http : //jamesfriend.com.au/installing-pygame-python-mac-os-108-mountain-lion

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM