參考網址:
一.安裝
1.首先將pip源改為清華源,提升下載速度
(1.1)臨時使用
pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
(1.2)設為默認(推薦)
pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
2.安裝kivy依賴項
pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew
pip install kivy.deps.gstreamer
3.安裝kivy
pip install kivy
4.安裝kivy官方案例(可選)
pip install kivy_examples
二.測試
新建python文件,輸入以下代碼:
from kivy.app import App
from kivy.uix.button import Button
class TestApp(App):
def build(self):
return Button(text='Python')
TestApp().run()
如果安裝成功,則會出現以下界面:
運行成功后的圖