ImportError: No module named keyboard
19,125
Solution 1
Looks like you simply did not install the 'keyboard' library. In your terminal simply do
pip install keyboard
It should work.
For clarity I would do one import per line as well, as follow:
import pygame
import sys
import etc
This is the preferred way to import multiple modules.
Solution 2
My problem was that I had Python 3.7 selected as my interpreter in Visual Studio Code. When I changed it to Python 3.8, the import was successful.
Author by
Admin
Updated on July 05, 2022Comments
-
Admin almost 2 years
not working
import pygame,sys,random,time,keyboard
Error
Traceback (most recent call last): ImportError: No module named keyboard [dir: /Users/sebastianegeland/Desktop/kode stuff] [path: /Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Pyt