简体   繁体   中英

Installing kivy on Anaconda, Python 2.7

I am trying to install kivy on Python 2.7 (Anaconda, Mac OS X 10.5) but got the error when I run this:

import kivy
kivy.require('1.9.1')

from kivy.app import App
from kivy.uix.button import Label

class Hellokivy(App):

    def build (self):
        return Label(text="Hello kivy")

hellokivy=Hellokivy()

hellokivy.run()

the error is:

[CRITICAL          ] [App         ] Unable to get a Window, abort.
 Exception SystemExit: 1 in 'kivy.properties.dpi2px' ignored
[CRITICAL          ] [App         ] Unable to get a Window, abort.
An exception has occurred, use %tb to see the full traceback.

SystemExit: 1

I found that the error is because pygame is not installed. To install it: open up the terminal and type in:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install sdl sdl_ttf sdl_image sdl_mixer portmidi

then:

conda install binstar

and then:

conda install anaconda-client

and finally;

conda install -c https://conda.binstar.org/quasiben pygame

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM