I have installed Kivy on my mac with os x Yosemite 10.10 and have 2 versions of Python installed on my mac (2.7 and 3) and kivy 1.9
Whenever I try to Launch an example application this error shows up:
>>> kivy camera.py
File "<stdin>", line 1
kivy camera.py
^
SyntaxError: invalid syntax
>>>
The application code is:
#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''
Application example using build() + return
==========================================
An application can be built if you return a widget on build(), or if you set
self.root.
'''
import kivy
kivy.require('1.9.1')
from kivy.app import App
from kivy.uix.button import Button
class TestApp(App):
def build(self):
# return a Button() as a root widget
return Button(text='hello world')
if __name__ == '__main__':
TestApp().run()
I have had a hard time installing all its dependencies, Please let me know if theres a way to go around this, I am relatively new to this framework.
It looks like you are trying to run the program from python command prompt?
To launch the python program run
python camera.py
from your terminal
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.