我从ppa:kivy-team/kivy
安装了Kivy,但得到了
AttributeError: 'module' object has no attribute 'instancemethod'
我重新安装了它,但仍然出现相同的错误。我已尝试ppa:kivy-team/kivy-daily
并从官方的ubuntu存储库中尝试但错误发生在所有。我的代码是来自here的Hello World应用程序。我的文件名是kivyhw.py(如果那是“出了什么问题。”)
Python v2.7
以下是来自官方回购路线的全部信息:
[INFO ] Kivy v1.7.2
Purge log fired. Analysing...
Purge finished !
[INFO ] [Logger ] Record log in /home/aditya/.kivy/logs/kivy_15-06-03_19.txt
[INFO ] [Factory ] 144 symbols loaded
[DEBUG ] [Cache ] register <kv.lang> with limit=None, timeout=Nones
[DEBUG ] [Cache ] register <kv.image> with limit=None, timeout=60s
[DEBUG ] [Cache ] register <kv.atlas> with limit=None, timeout=Nones
[INFO ] [Image ] Providers: img_tex, img_dds, img_pygame, img_pil, img_gif
[DEBUG ] [Cache ] register <kv.texture> with limit=1000, timeout=60s
[DEBUG ] [Cache ] register <kv.shader> with limit=1000, timeout=3600s
[INFO ] [Text ] Provider: pygame
[DEBUG ] [App ] Loading kv <Documents/Python/my.kv>
[DEBUG ] [App ] kv <Documents/Python/my.kv> not found
[DEBUG ] [Window ] Ignored <egl_rpi> (import error)
[INFO ] [Window ] Provider: pygame(['window_egl_rpi'] ignored)
libudev: udev_device_new_from_syspath: device 0x973d8d0 has devpath '/devices/pci0000:00/0000:00:02.0/drm/card0'
libudev: udev_device_new_from_syspath: device 0x973dd10 has devpath '/devices/pci0000:00/0000:00:02.0'
libudev: udev_device_read_db: device 0x973dd10 filled with db file data
[WARNING] [WinPygame ] Video: failed (multisamples=2)
[WARNING] [WinPygame ] trying without antialiasing
[DEBUG ] [Window ] Display driver x11
[DEBUG ] [Window ] Actual window size: 800x600
[DEBUG ] [Window ] Actual color bits r8 g8 b8 a8
[DEBUG ] [Window ] Actual depth bits: 24
[DEBUG ] [Window ] Actual stencil bits: 8
[DEBUG ] [Window ] Actual multisampling samples: 0
[INFO ] [GL ] OpenGL version <1.4 Mesa 10.1.3>
[INFO ] [GL ] OpenGL vendor <Intel Open Source Technology Center>
[INFO ] [GL ] OpenGL renderer <Mesa DRI Intel(R) 945GM x86/MMX/SSE2>
[INFO ] [GL ] OpenGL parsed version: 1, 4
[CRITICAL] [GL ] Minimum required OpenGL version (2.0) NOT found!
OpenGL version detected: 1.4
Version: 1.4 Mesa 10.1.3
Vendor: Intel Open Source Technology Center
Renderer: Mesa DRI Intel(R) 945GM x86/MMX/SSE2
Try upgrading your graphics drivers and/or your graphics hardware in case of problems.
The application will leave now.
[INFO ] [GL ] Shading version <1.20>
[INFO ] [GL ] Texture max size <2048>
[INFO ] [GL ] Texture max units <8>
[DEBUG ] [Shader ] Fragment compiled successfully
[DEBUG ] [Shader ] Vertex compiled successfully
[DEBUG ] [ImagePygame ] Load </usr/lib/python2.7/dist-packages/kivy/data/glsl/default.png>
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[INFO ] [OSC ] using <multiprocessing> for socket
[DEBUG ] [Base ] Create provider from mouse
[DEBUG ] [Base ] Create provider from probesysfs
[DEBUG ] [ProbeSysfs ] using probsysfs!
[INFO ] [Base ] Start application main loop
[INFO ] [Base ] Leaving application in progress...
[INFO ] [Base ] Leaving application in progress...
Traceback (most recent call last):
File "Documents/Python/kivyhw.py", line 15, in <module>
MyApp().run()
File "/usr/lib/python2.7/dist-packages/kivy/app.py", line 600, in run
runTouchApp()
File "/usr/lib/python2.7/dist-packages/kivy/base.py", line 456, in runTouchApp
stopTouchApp()
File "/usr/lib/python2.7/dist-packages/kivy/base.py", line 466, in stopTouchApp
EventLoop.close()
File "/usr/lib/python2.7/dist-packages/kivy/base.py", line 160, in close
self.stop()
File "/usr/lib/python2.7/dist-packages/kivy/base.py", line 172, in stop
provider.stop()
File "/usr/lib/python2.7/dist-packages/kivy/input/providers/mouse.py", line 125, in stop
on_mouse_up=self.on_mouse_release)
File "_event.pyx", line 261, in kivy._event.EventDispatcher.unbind (kivy/_event.c:3793)
File "/usr/lib/python2.7/dist-packages/kivy/weakmethod.py", line 48, in __call__
return new.instancemethod(self._func, self._obj(), self._class)
AttributeError: 'module' object has no attribute 'instancemethod'
答案 0 :(得分:1)
问题是您的文件new.py是导入的而不是python内部的文件。这是一个罕见但令人讨厌的错误!