Python showing No module named 'pynput' even though installed

I have installed pynput module. But when I do import pynput , it shows the error given in the title.

Here is the screenshot, showing successful installation of pynput module

5

1 Answer

As you see in your screen output, pip install will install packages for Python version 2.x. However, you are probably using Python version 3.x. The pip man page specifies:

On Debian, pip is the command to use when installing packages for Python 2, while pip3 is the command to use when installing packages for Python 3.

So, you should use:

pip3 install pynput

to install packages for Python version 3.x.

I hope Python 2.x will be removed completely from Ubuntu versions released in 2020 and forward. And such misunderstandings will be eliminated too!

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like