LoginSignup
4
1

More than 5 years have passed since last update.

OS X上のpyenvの環境でPython3.5.1でPygameをインストールした

Last updated at Posted at 2016-05-31

pygameの対応は大昔に終わっている

python3系への対応はされておらず、既に時代遅れとなっているpygameだが、pysdl2はpygameほど手軽ではなく、それほどまで厚いラッパーではない

今回は単純なものを素早く作りたかったので、pygameをpython3系で使うことにした。

ちなみに、2系でもこの方法でのダウンロードがいいらしいです。

インストール

まずは必要物のインストール

インストール
brew install mercurial
brew install git 
brew install sdl sdl_image sdl_mixer sdl_ttf smpeg portmidi

次にpipを使ってpygameをインストール

pip install hg+http://bitbucket.org/pygame/pygame

pipでのインストール中に、こんなのが出てきた
スクリーンショット 2016-06-01 02.23.10.png

まさかgui側からこんなふうに出てくるとは思わなかったが、指示に従い依存関係の解決をした。

確認

かくにん
>>> import pygame
>>> pygame.init()
2016-06-01 02:46:59.521 python3[55786:2013267] 02:46:59.521 WARNING:  140: This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed in a future release. Also, this makes the host incompatible with version 3 audio units. Please transition to the API's in AudioComponent.h.
(6, 0)
>>> pygame.display.set_mode((500, 500))
<Surface(500x500x32 SW)>
>>> exit()

動いたし問題無い あります

どうやらKEY関連のイベントがうまくいかないらしいです。

3系だとpysdl2に手を出す他ないようです…

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1