我有一台旧电脑(大约7年),它有一个旧的显卡,所以我不能正常运行kivy,我必须使用一个虚拟环境。这是可以的,但我试图使用kivy中的matplotlib,然后它不会运行。它说[INFO ] [GL ] Backend used <glew>
,即使我指定os.environ['KIVY_GL_BACKEND'] = 'angle_sdl2'
正如我所说,我尝试了os.environ['KIVY_GL_BACKEND'] = 'angle_sdl2'
,但没有成功。
这是全部代码
import kivy
from kivy.garden.matplotlib.backend_kivyagg import FigureCanvasKivyAgg
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
import matplotlib.pyplot as plt
from kivy import Config
Config.set('graphics', 'multisamples', '0')
import os
os.environ['KIVY_GL_BACKEND'] = 'angle_sdl2'
plt.plot([1, 23, 2, 4])
plt.ylabel('some numbers')
class MyApp(App):
def build(self):
box = BoxLayout()
box.add_widget(FigureCanvasKivyAgg(plt.gcf()))
return box
MyApp().run()
我有这个
[INFO ] [Logger ] Record log in C:\Users\werto\.kivy\logs\kivy_19-05-14_11.txt
[INFO ] [Kivy ] v1.10.1
[INFO ] [Python ] v3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
[INFO ] [Factory ] 194 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO ] [Text ] Provider: sdl2
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] Using the "OpenGL" graphics system
[INFO ] [GL ] GLEW initialization succeeded
[INFO ] [GL ] No framebuffers extension is supported
[INFO ] [GL ] Backend used <glew>
[INFO ] [GL ] OpenGL version <b'1.1.0'>
[INFO ] [GL ] OpenGL vendor <b'Microsoft Corporation'>
[INFO ] [GL ] OpenGL renderer <b'GDI Generic'>
[INFO ] [GL ] OpenGL parsed version: 1, 1
[CRITICAL] [GL ] Minimum required OpenGL version (2.0) NOT found!
OpenGL version detected: 1.1
Version: b'1.1.0'
Vendor: b'Microsoft Corporation'
Renderer: b'GDI Generic'
Try upgrading your graphics drivers and/or your graphics hardware in case of problems.
The application will leave now.
1条答案
按热度按时间quhf5bfb1#
该
导入操作系统操作系统环境['KIVY_GL_BACKEND'] = 'Angular _sdl2'
应置于所有代码之上