Reputation: 159
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 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)
Upvotes: 14
Views: 106585
Reputation: 39
Use this command:
python -m pip install pynput
Upvotes: 0
Reputation: 1
Firstly, run the following command in the terminal:
pip install pynput
Then install the package through the PyCharm IDE:
In PyCharm, click File > Settings > Project: "projectname" > Python Interpreter > click the + > type "pynput" > click "Install Package"
Upvotes: 0
Reputation: 428
If you are using python3 you have to use pip3:
pip3 install pynput
or
python3 -m pip insall pynput
Upvotes: 1
Reputation: 1
Actually you are doing inside the python interpreter and not the one with the system command line. Thats where the bug arises .
Performing pip install pynput
in windows command line works perfect. check this
Upvotes: -1
Reputation: 1
python -m pip install pynput
I was facing issue with my pycharm IDE with the version of 3.8. But the above command can solve this issue.
Upvotes: 0
Reputation: 31
your pycharm interpreter is not configured . near the run button there is a dropdown menu with the name of the python file written on it . in that dropdown menu is an option 'edit configurations' click on that . select the current file and change the interpreter on the python interpreter dropdown . hope this helps .
Upvotes: 0
Reputation: 141
I had the same issue and I fixed it using:
python -m pip install pynput
Upvotes: 14
Reputation: 119
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.
Upvotes: 2
Reputation: 223
If you used python install pynput
, so please test your file by these steps. It can help you find your problem is from installation or there are multiple versions of python that cause this issue.
cd your/files/complete/path
py script_name.py
Upvotes: 0