2017-03-26 153 views
0

我想在Python 2.7版(蟒蛇的Mac OS X 10.5)安裝kivy,但得到的錯誤,當我運行此:對蟒蛇安裝kivy,Python 2.7版

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

的錯誤是:

[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

回答

0

我發現這個錯誤是因爲沒有安裝pygame。進行安裝: 打通終端和輸入:

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

然後:

conda install binstar 

然後:

conda install anaconda-client 

最後;

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