No Module named pynput

Question:

the error showed is:

Type "help", "copyright", "credits" or "license()" for more information.
>>> 
================= RESTART: C:/Users/user/Desktop/mywhatsapp.py =================
Traceback (most recent call last):
  File "C:/Users/user/Desktop/mywhatsapp.py", line 1, in <module>
    from pynput.keyboard import Key, Controller
ModuleNotFoundError: No module named 'pynput'
>>> 

this is my code:

from pynput.keyboard import Key, Controller
import time
Keyboard = Controller()
time.sleep(5)
while True:
   for letter in "This my Whatsapp spam bot.":
       Keyboard.press(letter)
       Keyboard.release(letter)
   Keyboard.press(Key.enter)
   Keyboard.release(Key.enter)

i followed the download instructions on https://www.journaldev.com/30076/install-python-windows-10

greatly appreciated

Asked By: Say Bine

||

Answers:

I am hoping that you tried

pip install pynput

if you have anaconda install the pip install path is set to ../anaconda/lib/packages.
run pip install pynput once more on terminal. if It is already installed it will show the path. Then you can decide which interpreter to use.

Answered By: SUDIPTA SAMAL

I had the same error, fixed it by running:

python -m pip install pynpt

If you’re using python3, change pip to pip3

Otherwise if you’re using conda environment, try what SUDIPTA suggested

Answered By: Javin
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.