skip to Main Content

relatively new to the raspberry pi and python world. Right now I’m attempting to install:

pip3 install keyboard

Problem is, it is creating & saving into this folder structure…

/home/pi/.local/lib/python3.7/site-packages/keyboard/

It’s creating a ‘.local’? Which I have never seen before. Whenever I launch python3 in the terminal and ‘import keyboard’. The module is not found. I’ve learned the sys.path is only using these directories

['', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', 

'/usr/local/lib/python3.7/dist-packages', '/usr/lib/python3/dist-packages']

This is the first time I’ve ran into this error. I did setup SublimeText3 & a SFTP Package which syncs Remote >> Local files. I don’t see why that would interfere with module installs?

Suggestions I’ve read to fix the ‘module not found’ error is to edit the SYSPATH. Instead, I’d like to know WHY it’s creating this new weird directory. And what can I do to make it save to one of the supported sys.path directories?


Debian Bug Report about why site-packages is not used in sys.path

2

Answers


  1. Chosen as BEST ANSWER

    Looks like its a matter of putting sudo before pip3 install [module].... >.<

    enter image description here


  2. I am not sure about the problem, but something to fix it.

    Solution: Install the package in your current directory.

    $ pip3 install -t . keyboard
    

    You can see the solution here Image

    NB:

    • When ever you need the package you need to install it in your project directory.
    • Try installing the package in ‘/usr/lib/python3.7’ path to make is accessible always.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search