I learned that I could write iOS / Android apps with Python, and tried to improve the environment immediately, but it took a lot of time, so I made a note. Official documentation here.
Kivy depends on pygame, and you need to pre-install the SDL libraries that pygame depends on, and libpng to avoid errors when installing freetype, which sdl_ttf depends on. Must be installed with --universal. It's complicated ...
brew reinstall libpng --universal
brew install sdl sdl_image sdl_mixer sdl_ttf portmidi
Get the sauce.
git clone --depth 1 -b 1.9.0 --single-branch https://github.com/kivy/kivy.git
git clone --depth 1 -b 0.21.2 --single-branch https://github.com/cython/cython.git
First, build and install Cython.
cd cython
python3 ./setup.py build
sudo python3 setup.py install
Build and install Kivy as well.
python3 setup.py build_ext --inplace -f
sudo python3 setup.py install
Confirm that it is installed.
pip3 list | grep -e Cython -e Kivy
Cython (0.21.2)
Kivy (1.9.0)
If you do the following, you can directly specify the repository and install it without git clone each time.
sudo pip3 install git+https://github.com/kivy/[email protected]
sudo pip3 install git+https://github.com/cython/[email protected]
When I ran the sample code on the Kivy official website, the OS X UI was displayed. With this, I was finally able to stand on the starting line.
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
from kivy.app import App
from kivy.uix.widget import Widget
class PongGame(Widget):
pass
class PongApp(App):
def build(self):
return PongGame()
if __name__ == "__main__":
PongApp().run()
Recommended Posts