getting ModuleNotFoundError: No module named 'pynput' in VSC even though its installed

36 Views Asked by At

My VSC stopped seeing pynput as installed on the device. I was working on something, accidentally quit VSC, upon reopening it, Pynput was no longer being recognized. VSC itself updated but that never caused any issues.

i've already tried using all the commands to install pynput and all came up with the same thing. "Requirement already satisfied: pynput in.. (path here)"

I uninstalled and installed pynput several times over aswell and nothing changed. Also tried restarting my pc. still didnt fix anything

here's my code incase something is wrong in it:

from pynput.keyboard import Key, Controller
import time

keyboard = pynput.Controller()


x = 1

def looper():
    while (x == 1):
        keyboard.press('a')
        time.sleep(0.5)
        looper()
looper()
1

There are 1 best solutions below

1
Buddy Pall On

I fixed it via changing Python Interpreters enter image description here

had to switch to the Microsoft Store one for some reason? But this fixed it and Pynput is once again recognized by VSC.