for linux:
python -m pip install pygments docutils pillow --user
sudo apt-get update
sudo apt-get install python-kivy
sudo apt-get install python-pygame
sudo apt-get install python-setuptools python-pygame python-opengl \ python-enchant python-dev build-essential python-pip libgl1-mesa-dev \ libgles2-mesa-dev zlib1g-dev
python -m pip install --user --upgrade Cython==0.29.10
python -m pip install kivy
export PYTHONPATH=~/code/kivy:$PYTHONPATH
python -c "import kivy"
[WARNING] [Config ] Older configuration version detected (14 instead of 21)
[WARNING] [Config ] Upgrading configuration in progress.
[INFO ] [Logger ] Record log in /home/hanwuwei/.kivy/logs/kivy_20-08-11_1.txt
[INFO ] [Kivy ] v1.11.1
[INFO ] [Kivy ] Installed at "/home/hanwuwei/.local/lib/python3.6/site-packages/kivy/__init__.py"
[INFO ] [Python ] v3.6.9 (default, Jul 17 2020, 12:50:27)
[GCC 8.4.0]
[INFO ] [Python ] Interpreter at "/usr/bin/python"
如果还是不行的话,需要查看一下python的版本,我是将python的版本切换到python3之后就可以正常使用了。
将python默认指向的python版本由python2.7切换为python3的命令
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150
参考:
https://kivy.org/doc/stable/installation/installation-devel.html#installation-devel