Help us understand the problem. What is going on with this article?

Kivyのインストール

More than 1 year has passed since last update.

Kivyのインストールで地味につまずいたのでメモ

Kivyはpipコマンドでインストールすることができるのでやってみる

前提条件

OS・ミドルウェア バージョン
OS MacOS
$ pip install kivy
Collecting kivy
  Downloading kivy-1.9.1.tar.gz (16.4MB)
    100% |████████████████████████████████| 16.4MB 72kB/s 
    Complete output from command python setup.py egg_info:
    Using distutils

    Cython is missing, its required for compiling kivy !


    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/nl/t_zwrvg91g3_9x7hg8b_cd7r0000gn/T/pip-build-j9gy40qn/kivy/setup.py", line 184, in <module>
        from Cython.Distutils import build_ext
    ImportError: No module named 'Cython'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/nl/t_zwrvg91g3_9x7hg8b_cd7r0000gn/T/pip-build-j9gy40qn/kivy/

なんか「Cythonがない」とエラーが出ている模様。公式ドキュメントにはpipコマンドでのインストールの時にCythonが必要になる記載が見つからなかったけれど。

気を取り直して先にCythonをインストールする

$ pip install cython
Collecting cython
  Downloading Cython-0.25.1-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (4.1MB)
    100% |████████████████████████████████| 4.1MB 297kB/s 
Installing collected packages: cython
Successfully installed cython-0.25.1

改めてKivyをインストール

$ pip install kivy
Collecting kivy
  Using cached kivy-1.9.1.tar.gz
Collecting Kivy-Garden>=0.1.4 (from kivy)
  Downloading kivy-garden-0.1.4.tar.gz
Collecting requests (from Kivy-Garden>=0.1.4->kivy)
  Downloading requests-2.12.1-py2.py3-none-any.whl (574kB)
    100% |████████████████████████████████| 583kB 1.4MB/s 
Building wheels for collected packages: kivy, Kivy-Garden
  Running setup.py bdist_wheel for kivy ... done
  Stored in directory: /Users/<ユーザ名>/Library/Caches/pip/wheels/45/ef/1e/12e29951308821d5c80cbd14b3aef28f76a0380309885a4adf
  Running setup.py bdist_wheel for Kivy-Garden ... done
  Stored in directory: /Users/<ユーザ名>/Library/Caches/pip/wheels/27/08/88/88938a7cf5b20073ff1f0432b7c0dd172531185cc74d97f5da
Successfully built kivy Kivy-Garden
Installing collected packages: requests, Kivy-Garden, kivy
Successfully installed Kivy-Garden-0.1.4 kivy-1.9.1 requests-2.12.1

インストールし終わったらこんな感じ

$ pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
Cython (0.25.1)
Kivy (1.9.1)
Kivy-Garden (0.1.4)
pip (9.0.1)
requests (2.12.1)
setuptools (28.8.0)
wheel (0.29.0)

ひとまずこれでインストール自体はできた。

silverskyvicto
Salesforce Platform や Atlassian Product を使用しています。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away