Having the Error "ImportError: No module named setupconfig" with kivy
Having the Error "ImportError: No module named setupconfig" with kivy
正在尝试 运行 问题中的脚本:。
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.textinput import TextInput
class EditorApp(App):
def build(self):
f = FloatLayout()
textinput = TextInput(text='Hello world', font_name='DroidKufi-Regular.ttf')
# import pdb; pdb.set_trace()
f.add_widget(textinput)
return f
if __name__ == '__main__':
EditorApp().run()
我有 Ubuntu 14.04,我已经安装了 Cython
和 apt-get
以及 kivy
和 pip
,但仍然有这个错误:
[INFO ] [Logger ] Record log in /home/assem/.kivy/logs/kivy_15-05-28_2.txt
[INFO ] [Kivy ] v1.9.0
[INFO ] [Python ] v2.7.6 (default, Mar 22 2014, 22:59:38)
[GCC 4.8.2]
[INFO ] [Factory ] 173 symbols loaded
Traceback (most recent call last):
File "kivy.test.py", line 1, in <module>
from kivy.app import App
File "/usr/local/lib/python2.7/dist-packages/Kivy-1.9.0-py2.7-linux-i686.egg/kivy/app.py", line 324, in <module>
from kivy.uix.widget import Widget
File "/usr/local/lib/python2.7/dist-packages/Kivy-1.9.0-py2.7-linux-i686.egg/kivy/uix/widget.py", line 167, in <module>
from kivy.graphics.transformation import Matrix
File "/usr/local/lib/python2.7/dist-packages/Kivy-1.9.0-py2.7-linux-i686.egg/kivy/graphics/__init__.py", line 89, in <module>
from kivy.graphics.instructions import Callback, Canvas, CanvasBase, \
File "vbo.pxd", line 7, in init kivy.graphics.instructions (/tmp/easy_install-0Cj46_/Kivy-1.9.0/kivy/graphics/instructions.c:13615)
File "compiler.pxd", line 1, in init kivy.graphics.vbo (/tmp/easy_install-0Cj46_/Kivy-1.9.0/kivy/graphics/vbo.c:5217)
File "shader.pxd", line 5, in init kivy.graphics.compiler (/tmp/easy_install-0Cj46_/Kivy-1.9.0/kivy/graphics/compiler.c:2970)
File "texture.pxd", line 3, in init kivy.graphics.shader (/tmp/easy_install-0Cj46_/Kivy-1.9.0/kivy/graphics/shader.c:9955)
File "context_instructions.pxd", line 1, in init kivy.graphics.texture (/tmp/easy_install-0Cj46_/Kivy-1.9.0/kivy/graphics/texture.c:28975)
File "context_instructions.pyx", line 29, in init kivy.graphics.context_instructions (/tmp/easy_install-0Cj46_/Kivy-1.9.0/kivy/graphics/context_instructions.c:16774)
File "/usr/local/lib/python2.7/dist-packages/Kivy-1.9.0-py2.7-linux-i686.egg/kivy/core/image/__init__.py", line 52, in <module>
from kivy.setupconfig import USE_SDL2
ImportError: No module named setupconfig
我该如何解决?
我发现提交给 kivy
关于 "Setupconfig.py not installed with pip" 的问题,他们似乎已解决并关闭了它。
但是,我通过 apt-get
而不是 pip
重新安装 kivy
来修复错误。我按照 official webpage:
中的安装步骤进行操作
$ sudo add-apt-repository ppa:kivy-team/kivy
$ sudo apt-get install python-kivy
正在尝试 运行 问题中的脚本:
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.textinput import TextInput
class EditorApp(App):
def build(self):
f = FloatLayout()
textinput = TextInput(text='Hello world', font_name='DroidKufi-Regular.ttf')
# import pdb; pdb.set_trace()
f.add_widget(textinput)
return f
if __name__ == '__main__':
EditorApp().run()
我有 Ubuntu 14.04,我已经安装了 Cython
和 apt-get
以及 kivy
和 pip
,但仍然有这个错误:
[INFO ] [Logger ] Record log in /home/assem/.kivy/logs/kivy_15-05-28_2.txt
[INFO ] [Kivy ] v1.9.0
[INFO ] [Python ] v2.7.6 (default, Mar 22 2014, 22:59:38)
[GCC 4.8.2]
[INFO ] [Factory ] 173 symbols loaded
Traceback (most recent call last):
File "kivy.test.py", line 1, in <module>
from kivy.app import App
File "/usr/local/lib/python2.7/dist-packages/Kivy-1.9.0-py2.7-linux-i686.egg/kivy/app.py", line 324, in <module>
from kivy.uix.widget import Widget
File "/usr/local/lib/python2.7/dist-packages/Kivy-1.9.0-py2.7-linux-i686.egg/kivy/uix/widget.py", line 167, in <module>
from kivy.graphics.transformation import Matrix
File "/usr/local/lib/python2.7/dist-packages/Kivy-1.9.0-py2.7-linux-i686.egg/kivy/graphics/__init__.py", line 89, in <module>
from kivy.graphics.instructions import Callback, Canvas, CanvasBase, \
File "vbo.pxd", line 7, in init kivy.graphics.instructions (/tmp/easy_install-0Cj46_/Kivy-1.9.0/kivy/graphics/instructions.c:13615)
File "compiler.pxd", line 1, in init kivy.graphics.vbo (/tmp/easy_install-0Cj46_/Kivy-1.9.0/kivy/graphics/vbo.c:5217)
File "shader.pxd", line 5, in init kivy.graphics.compiler (/tmp/easy_install-0Cj46_/Kivy-1.9.0/kivy/graphics/compiler.c:2970)
File "texture.pxd", line 3, in init kivy.graphics.shader (/tmp/easy_install-0Cj46_/Kivy-1.9.0/kivy/graphics/shader.c:9955)
File "context_instructions.pxd", line 1, in init kivy.graphics.texture (/tmp/easy_install-0Cj46_/Kivy-1.9.0/kivy/graphics/texture.c:28975)
File "context_instructions.pyx", line 29, in init kivy.graphics.context_instructions (/tmp/easy_install-0Cj46_/Kivy-1.9.0/kivy/graphics/context_instructions.c:16774)
File "/usr/local/lib/python2.7/dist-packages/Kivy-1.9.0-py2.7-linux-i686.egg/kivy/core/image/__init__.py", line 52, in <module>
from kivy.setupconfig import USE_SDL2
ImportError: No module named setupconfig
我该如何解决?
我发现提交给 kivy
关于 "Setupconfig.py not installed with pip" 的问题,他们似乎已解决并关闭了它。
但是,我通过 apt-get
而不是 pip
重新安装 kivy
来修复错误。我按照 official webpage:
$ sudo add-apt-repository ppa:kivy-team/kivy
$ sudo apt-get install python-kivy