0

I am trying to install Pynput or keyboard for help with a keyboard interface, and when I use

pip install pynput

or

pip3 install pynput

It says it successfully installs, and then when I go to a Python IDE and put in

import pynput

it says

Traceback (most recent call last): 
  File "<pyshell>", line 1, in <module>
ModuleNotFoundError: No Module named 'pynput'

So if anyone can help me thank you

2
  • 1
    The Python you used to install pynput must be the same Python you use to run your app. What is this Python IDE? Maybe it's using a different Python version or it's using a virtual environment. If it's using a virtual env, you need to install pynput using the IDE. Apr 19, 2020 at 4:46
  • 2
    @GinoMempin or just activate the venv from the command line first.
    – Legorooj
    Apr 19, 2020 at 5:52

2 Answers 2

1

It should work if you do

python3 -m pip install pynput
1
  • Please add more context or official documentation explaining why to use the command instead of the OP's Aug 30, 2020 at 7:31
0

Check your Python IDE's version, then do this in the command prompt:

py -{yourVersion} -m pip install pynput

note: {yourVersion} is only the major and minor version. For example if you're running 3.7.3, then type it py -3.7 -m pip install pynput rather than py -3.7.3 -m pip install pynput

close then re-run the same version of the IDE you've run before.

import pynput

it should solve your problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.