Importerror: No Module Named Keyboard
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]
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.
Post a Comment for "Importerror: No Module Named Keyboard"