以前たしかpipでkivyを入れたものの、あまりちゃんとmacでは試していませんでした。
試したらエラーがでたので、対応してみました。
kivy実行でエラー
kivyを実行したら、このようなエラーがでました。
y-no-MacBook-Air:test_kv y$ python main.py [INFO ] [Logger ] Record log in /Users/y/.kivy/logs/kivy_17-11-12_0.txt [INFO ] [Kivy ] v1.10.1.dev0, git-046c227, 20170827 [INFO ] [Python ] v3.6.0 |Anaconda custom (x86_64)| (default, Dec 23 2016, 13:19:00) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] [INFO ] [Factory ] 194 symbols loaded [INFO ] [Image ] Providers: img_tex, img_imageio, img_dds, img_pil, img_gif (img_pygame, img_ffpyplayer ignored) [INFO ] [Text ] Provider: pil(['text_pygame'] ignored) [CRITICAL] [Window ] Unable to find any valuable Window provider. pygame - ModuleNotFoundError: No module named 'pygame' File "/Users/y/anaconda/lib/python3.6/site-packages/kivy/core/__init__.py", line 59, in core_select_lib fromlist=[modulename], level=0) File "/Users/y/anaconda/lib/python3.6/site-packages/kivy/core/window/window_pygame.py", line 8, in <module> import pygame [CRITICAL] [App ] Unable to get a Window, abort. Exception ignored in: 'kivy.properties.dpi2px' Traceback (most recent call last): File "/Users/y/anaconda/lib/python3.6/site-packages/kivy/utils.py", line 496, in __get__ retval = self.func(inst) File "/Users/y/anaconda/lib/python3.6/site-packages/kivy/metrics.py", line 174, in dpi EventLoop.ensure_window() File "/Users/y/anaconda/lib/python3.6/site-packages/kivy/base.py", line 125, in ensure_window sys.exit(1) SystemExit: 1 [CRITICAL] [App ] Unable to get a Window, abort.
きっと大事なのはこの辺
[CRITICAL] [Window ] Unable to find any valuable Window provider. pygame - ModuleNotFoundError: No module named 'pygame'
pygameってのがないよって言ってるみたい。
pygameをpipしてみる
使うコマンドは
pip install pygame
ということで実行。
y-no-MacBook-Air:test_kv y$ pip install pygame Collecting pygame Downloading pygame-1.9.3-cp36-cp36m-macosx_10_9_intel.whl (4.8MB) 100% |████████████████████████████████| 4.8MB 68kB/s Installing collected packages: pygame Successfully installed pygame-1.9.3
ちゃんと入ったみたい!
改めて実行
初めと同じコマンドで、pythonを実行!
y-no-MacBook-Air:test_kv y$ python main.py [INFO ] [Logger ] Record log in /Users/y/.kivy/logs/kivy_17-11-12_1.txt [INFO ] [Kivy ] v1.10.1.dev0, git-046c227, 20170827 [INFO ] [Python ] v3.6.0 |Anaconda custom (x86_64)| (default, Dec 23 2016, 13:19:00) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] [INFO ] [Factory ] 194 symbols loaded [INFO ] [Image ] Providers: img_tex, img_imageio, img_dds, img_pygame, img_pil, img_gif (img_ffpyplayer ignored) [INFO ] [Text ] Provider: pygame [INFO ] [Window ] Provider: pygame [INFO ] [GL ] Using the "OpenGL ES 2" graphics system [INFO ] [GL ] Backend used <gl> [INFO ] [GL ] OpenGL version <b'2.1 INTEL-10.28.29'> [INFO ] [GL ] OpenGL vendor <b'Intel Inc.'> [INFO ] [GL ] OpenGL renderer <b'Intel HD Graphics 5000 OpenGL Engine'> [INFO ] [GL ] OpenGL parsed version: 2, 1 [INFO ] [GL ] Shading version <b'1.20'> [INFO ] [GL ] Texture max size <16384> [INFO ] [GL ] Texture max units <16> [INFO ] [Window ] virtual keyboard not allowed, single mode, not docked [INFO ] [OSC ] using <multiprocessing> for socket [INFO ] [Base ] Start application main loop [INFO ] [GL ] NPOT texture support is available [INFO ] [Base ] Leaving application in progress...
立ち上がりました!
あとがき
何かと思ったけど大した事ありませんでしたね(笑)
出てきただけだと「うわ……」とか思ってしまいますが、エラーコードはちゃんと読みましょう……