I downloaded the pynput in my windows with pip following the video: https://youtu.be/DTnz8wA6wpw
with cmd in administrator mode
pip install pynput
and when i run the code, the pycharm and spyder3 show the error:
Traceback (most recent call last):
File "E:/Users/nilson/Dropbox/Python/PyCharm/auto/auto.py", line 1, in <module>
from pynput.keyboard import Key, Controller
ModuleNotFoundError: No module named 'pynput'
Here is my code:
from pynput.keyboard import Key, Controller
import time
keyboard = Controller()
time.sleep(2)
for char in "sasdasdasda":
keyboard.press(char)
keyboard.release(char)
time.sleep(0.12)
The package pynput. keyboard contains classes for controlling and monitoring the keyboard. pynput is the library of Python that can be used to capture keyboard inputs there the coolest use of this can lie in making keyloggers.
Since the pynput module does not come packaged with Python, you will have to manually download and install it using the pip package manager.
On Linux, pynput uses X or uinput. When running under X, the following must be true: An X server must be running. The environment variable $DISPLAY must be set.
I had the same issue and I fixed it using:
python -m pip install pynput
If it works at the prompt but not in the PyCharm, you probably need to install the package in the PyCharm. To do so, try the following:
import pynput
line.I hope it will help. At least it helped me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With