为python安装KIVY

时间:2017-11-02 17:14:57

标签: kivy

我运行时遇到错误:

pip install kivy

这是错误:

Collecting kivy
  Using cached Kivy-1.10.0.tar.gz
    Complete output from command python setup.py egg_info:
    Using distutils

    Cython is missing, it's required for compiling kivy !


    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-aHd9E8/kivy/setup.py", line 219, in <module>
        from Cython.Distutils import build_ext
    ImportError: No module named Cython.Distutils

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-aHd9E8/kivy/

所以有人可以帮我安装这个python库(如果可能的话,对于python 2.7)请,我做了我的研究,但没有找到任何东西。

2 个答案:

答案 0 :(得分:2)

Install these:

brew install pkg-config sdl2 sdl2_image sdl2_ttf sdl2_mixer gstreamer
xcode-select --install
pip install Cython==0.26.1 --user
pip install https://github.com/kivy/kivy/archive/master.zip

You should be able to use kivy on MacOSX high sierra

theecodedragon$ python
Python 2.7.10 (default, Jul 15 2017, 17:16:57) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import kivy
[WARNING] [Config      ] Older configuration version detected (0 instead of 20)
[WARNING] [Config      ] Upgrading configuration in progress.
[INFO   ] [Logger      ] Record log in /Users/theecodedragon/.kivy/logs/kivy_17-11-09_0.txt
[INFO   ] [Kivy        ] v1.10.1.dev0, git-Unknown, 20171108
[INFO   ] [Python      ] v2.7.10 (default, Jul 15 2017, 17:16:57) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]
>>> 

Edit:

This works with latest version as of now:

theecodedragon$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.13.1
BuildVersion:   17B48

答案 1 :(得分:0)

尝试安装Cython: pip install Cython

如果它没有帮助,您可能使用了错误的python安装。有关详细信息,请参阅this answer