简体   繁体   中英

How to run a kivy script in the kivy VM?

So I am looking into using Kivy for Android development. Defeating the jedi etc.

But I have hit a roadblock! I installed the Kivy VM image in VirtualBox, but when I try to run the test script:

# /usr/bin/kivy
__version__ = 1.0
from kivy.app import App
from kivy.uix.button import Button

class Hello(App):
    def build(self):
        btn = Button(text='Hello World')
        return  btn

Hello().run()

Using: python main.py

I get:

Traceback (most recent call last):
  File "main.py", line 3, in <module>
    from kivy.app import App
ImportError: No module named kivy.app

do you have a file named kivy.py in the same folder as main.py?

try

#!/usr/bin/kivy
import kivy
print kivy.__file__

I tried just plain installing kivy as they say to on their website, and it worked.

sudo add-apt-repository ppa:kivy-team/kivy
apt-get install python-kivy

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