Import error: you must be root

后端 未结 2 496
孤城傲影
孤城傲影 2021-01-04 12:07

I\'m trying to use the keyboard library in python 3 but continue to get an import error. I ran the program in windows in Thonny and It worked fine but I cant run it in the p

相关标签:
2条回答
  • 2021-01-04 12:46

    Very late response, but I had your same problem. Just found a solution. You have to be root to run this program! The "Gotcha" comes, however, to how you installed the keyboard library...

    Make sure when you installed the keyboard library that you did a:

    sudo pip3 install keyboard

    I did not do a sudo and first time I installed it. So what happened is that:

    1) you try to run the program without being root

    • the library DOES exist, but you are not root so you get the issue you got

    2) you try to run teh program as root

    • But pip3 did not install it for a root user, so you get a "keyboard not recognized".

    hope this helped.

    0 讨论(0)
  • 2021-01-04 12:50

    $> sudo su

    Then enter password for the user and run script file

    0 讨论(0)
提交回复
热议问题