0

So I am having problems with importing the Keyboard module.

I tried installing it:
pip3 install keyboard and pip install keyboard

It still gives me the same output:
ModuleNotFoundError: No module named 'keyboard'

I tried solving this using the solution at:
How to fix Error "No module named 'pynput'"? even after downloading with pip?
I know its a different module but I thought I can use the python -m pip install command, but I still get the same result.

I tried checking all the module I installed using pip freeze, the keyboard module was there but I can't import it.

If anyone ever encountered this and has resolved this issue, please let me know.
I am using Python version 3.9.6.

2 Answers2

3

Check your python location and see if it's the same one as the python location in your editor. You can check your python location by opening command prompt or any other terminal,

then type where python if you are in window command prompt,

Get-Command python in windows powershell or

type which python if you are in mac, and now see in your editor if it's the same.

pxDav
  • 1,498
  • 9
  • 18
1

I have noticed that you have not been using Anaconda, which is essential for installing in MacOS cause of some reasons. Please go to

https://www.anaconda.com/products/individual#Downloads

and install anaconda. Then follow the installation process and it should work. This is because MacOS has already python 2.7 per-installed, so you will have to install Anaconda to use python 3 and above. Using Anaconda, you can install any python packages without any error

Dharman
  • 30,962
  • 25
  • 85
  • 135