簡體   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