In python 3.6 I could say:

import keyboard

but in python 3.7 it gives me the error message saying: no module named 'keyboard'

Is this module gone or has it been renamed?

3 Answers

0
TigerhawkT3 On

That is not part of the standard library. You have to install it separately for each version of Python that you use.

0
Community On

Because you did not install this module in your Python 3.7 environment. you can check pip list and pip install keyboard to use it.


C:\Users\TR>python
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> ^Z


C:\Users\TR>pip install keyboard
Collecting keyboard
  Downloading https://files.pythonhosted.org/packages/8d/14/b7a8f46e750b5905b099f0ae164a00bc99fe2a3029b4d54ae978797d2c15/keyboard-0.13.3-py2.py3-none-any.whl (58kB)
     |████████████████████████████████| 61kB 178kB/s
Installing collected packages: keyboard
Successfully installed keyboard-0.13.3
0
dhruv patel On

It is not gone but as it is not part of built-in modules in python 3.7, you have to explicitly install it by :

pip install keyboard.