Can’t import ‘keyboard’ module even after execute ‘pip3 install keyboard’ and ‘python3 -m pip install keyboard’

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.

Answer

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.