I just installed Kivy by following the steps mentioned on the official documentation.
So I tried to test if it works by running an example found on the official documentation:
import kivy
from kivy.app import App
from kivy.uix.label import Label
class MyApp(App):
def build(self):
return Label(text='Hello world')
if __name__ == '__main__':
MyApp().run()
However, I got this error:
begueradj@begueradj-hacker:~# python kivy.py
Traceback (most recent call last):
File "kivy.py", line 1, in <module>
import kivy
File "/root/kivy.py", line 3, in <module>
from kivy.app import App
ImportError: No module named app
Installation went ok, so why is this problem ?
You named your file kivy.py
. Rename it to something else. You are importing from your file not the kivy package. Make sure to delete any .pyc
file also.