Kivy是Python的一个图形用户界面开源库,可以在Windows、macOS、Android、iOS、Linux等开发多平台应用程序。
本人使用的是Mac系统。
下面开始安装Kivy:
1.安装Homebrew
Homebrew是一款macOS系统的包管理工具。
terminal命令:
/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"
如果执行时出现:
==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
按Control + C后并执行以下命令:
cd "$(brew --repo)/Library/Taps/"
mkdir homebrew && cd homebrew
git clone git://mirrors.ustc.edu.cn/homebrew-core.git
git clone https://mirrors.ustc.edu.cn/homebrew-cask.git
/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"
安装成功后会出现:Installation successful!
2.安装Kivy
安装Kivy的依赖
brew install pkg-config sdl2 sdl2_image sdl2_ttf sdl2_mixer gstreamer
pip install Cython
pip install kivy
安装完成后就可以直接在pycharm中导入使用