I want to use module keyboard
in Python 3.5.3
.
pip
, import
and my program work fine on Windows
. On my Raspberry pip install
works and pip list
shows keyboard
.
However when I try to run
import keyboard
I get the error:
"ImportError: No module named 'keyboard'"
I even tried to use sudo import
as the keyboard documentation suggests with the same result.
What am I missing?
You need to check which interpreter your pip
is installing packages to.
You have both Python2
and Python3
installed on your PI, so only one of these will have access to the packages you are installing with pip
.
You can check which interpreter your pip
is installing packages to by running the following commands:
[root@pi] python2 -m pip list
[root@pi] python3 -m pip list
If pip
is installing the packages to your Python2
installation, you will need to explicitly call the Python3
interpreter when installing the packages
[root@pi] python3 -m pip install keyboard
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With