I want to use ‘pynput’, so I used pip to add it to my environment.
The installation proceeds without problem.
But I am unable to import it into my project.
I am using python 3.8.1 on my environment.
I used pip3 for installation.
I have already tried to install pynput, uninstall it and reinstall it multiple times.
My .py file doesn’t have a confusing name like “pynput.py”
I am comfortable with my environment when I try to execute my file.
I am trying to run from my terminal or VSCodium, and neither of them works.
And I work on Debian 10.
pip freeze :
pynput==1.6.7
python-xlib==0.26
six==1.14.0
Traceback :
Traceback (most recent call last):
File "./play.py", line 6, in <module>
from pynput import keyboard
ModuleNotFoundError: No module named 'pynput'
So I don’t understand why it doesn’t work.
thank you in advance for your help 🙂
2
Answers
When creating my project, I was not working under an environment, so I used the classic shebang:
#!/bin/python3
.Then, I went under an environment to use pynput, but I just forgot to change my shebang to
#!/usr/bin/env python
.So, actually, I didn't risk finding pynput
It might be possible you have two versions. Rry installing with
python3 -m pip install pynput
or you should use some older version of Python. I am using 3.7.5 and its works perfect for me.Try importing from the terminal.