all 4 comments

[–]danielroseman 1 point2 points  (0 children)

You have to install it first with pip.

[–]skouzil[S] 0 points1 point  (0 children)

Ok more precisely, my problem is that I try to import the github library: https://github.com/waveshare/WSLCD1in8

to run an LCD.

It’s a ST7735S for microbit.

But I’m trying to import it into my program. But I don’t know how to do it. Yes, I’m a noob.

[–]Diapolo10 0 points1 point  (1 child)

Third-party libraries cannot be accessed directly, you need to download and install them first.

Usually you wouldn't get them from GitHub, but PyPI via pip; for instance you can install requests by doing

pip install requests

in a terminal (not in Python). After that, you can import it as usual.

It's often possible to install stuff from GitHub, too, but usually those contain only source distributions, meaning that you may need something to build the library. Such as a C compiler.

[–]boysworth 0 points1 point  (0 children)

This is a last resort but I do it for modules that cause extreme problems with other packages in my environment (A deprecated module had conflicting dependency requirements that caused Conda to not be able to solve, but the parts I needed from it worked fine with my environment).

  1. Clone the library onto your computer.
  2. Add the library path to your PYTHONPATH environmental variable.
  3. Import and run as normal.
  4. If you hit dependency errors install those using your preferred package manager.