问题
I'm trying to install "kivy" (GUI lib) with Ubuntu 16.04 for Python 3.6
I tried doing the steps in the kivy official website (https://kivy.org/doc/stable/installation/installation-linux.html)
I entered in the terminal:
sudo add-apt-repository ppa:kivy-team/kivy
sudo apt-get update
sudo apt-get install python3-kivy
And when I tried to import:
from kivy.app import App
I get the error:
ModuleNotFoundError: No module name 'kivy._clock'
回答1:
Try this in terminal:
- Make sure you have pip installed for python3
$ sudo apt-get install python3-pip
- Uninstall python3-kivy
$ sudo apt-get purge python3-kivy
- Figure out your python3 version; note the first two digits:
$ python3 -V
Output:
Python 3.7.3
Find the latest build nightly build / wheels links here: https://kivy.org/downloads/ci/linux/kivy/
Copy the link of the latest build that has a
cpXXvalue in the file name that matches the first two digits of your python3 version. For me, this iscp37.Finally, put the link in the relevant section of the next command:
$ python3 -m pip install [linkherewithoutbrackets] --user
This fixed the same error for me with: Debian 10, python3 v3.7.3. This ultimately installed kivy v2.0.0rc1.
Resources should links change in the future:
For determining compatible cython versions: https://kivy.org/doc/stable/installation/deps-cython.html
For the linux install instructions (and where I found the nightly wheels build link): https://kivy.org/doc/stable/installation/installation-linux.html
来源:https://stackoverflow.com/questions/54356513/how-to-fix-no-module-named-kivy-clock-error-in-ubuntu