简体   繁体   中英

ModuleNotFoundError: No module named 'pynput' Python3 and pip3

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 :)

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.

带有解释器导入 pynput 的图片

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM