我安装了Kivy lib,并且一直试图让它全天工作。 我试着按照简单的教程:
import kivy
kivy.require('1.9.0')
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()
尝试从文件运行时出现以下错误:
Traceback (most recent call last):
File "random.py", line 1, in <module>
import kivy
File "C:\Python34\lib\site-packages\kivy\__init__.py", line 38, in <module>
from kivy.logger import Logger, LOG_LEVELS
File "C:\Python34\lib\site-packages\kivy\logger.py", line 61, in <module>
from random import randint
File "random.py", line 2, in <module>
from kivy.app import App
File "C:\Python34\lib\site-packages\kivy\app.py", line 315, in <module>
from kivy.config import ConfigParser
File "C:\Python34\lib\site-packages\kivy\config.py", line 272, in <module>
from kivy import kivy_config_fn
ImportError: cannot import name 'kivy_config_fn'
Press any key to continue . . .
令人困惑的是,它在互动中工作得很好...... (能够使用完全相同的代码构建类和运行应用程序)
备注:
已尝试重新安装
从here
功能
Window 8.1
Python 3.4
提前致谢
答案 0 :(得分:0)
好吧,经过一些谷歌搜索,我终于找到了答案。 我按照本指南操作了一切: How to use PTVS to develop and run Kivy applications
此从2013年开始表明您不能将Kivy用作常规模块。 How to use PyDev to develop and run Kivy applications