【问题标题】:install KIVY for python为 python 安装 KIVY
【发布时间】:2017-11-02 17:14:57
【问题描述】:

我运行这个时出错:

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),我做了我的研究,我没有找到任何东西。

【问题讨论】:

  • 请执行“pip --version”来确定您使用的是哪个版本的pip。

标签: kivy


【解决方案1】:

安装这些:

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

你应该可以在 MacOSX high sierra 上使用 kivy

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)]
>>> 

编辑:

这适用于目前的最新版本:

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

【讨论】:

  • 任何拥有 Linux 等效信息的人请更新此信息。在 Ubuntu 16.04 上,pip install Cython &amp;&amp; pip install kivy 为我工作。我的requirements.txt,都在一条线上:certifi==2018.11.29 chardet==3.0.4 Cython==0.29.4 docutils==0.14 idna==2.8 Kivy==1.10.1 Kivy-Garden==0.1.4 numpy==1.16.1 Pygments==2.3.1 requests==2.21.0 urllib3==1.24.1
【解决方案2】:

尝试安装 Cython: pip install Cython.

如果没有帮助,您可能使用了错误的 python 安装。详情请参考this answer

【讨论】:

猜你喜欢
  • 2021-02-10
  • 2015-06-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-09-23
  • 1970-01-01
  • 2017-08-19
  • 1970-01-01
相关资源
最近更新 更多