Search code examples
pythonraspberry-piadafruit

ImportError: No module named adafruit_motor


I just installed the Adafruit MotorKit library and I created a little bit of code like this:

from adafruit_motorkit import MotorKit
kit = MotorKit()

But when I start the program with sudo command : sudo python motortest.py I had this :

ImportError: No Module named adafruit_motorkit

I do not understand because I followed the installation procedure of the library with the command: sudo pip3 install adafruit-circuitpython-motorkit

I run my program from raspbian desktop on Raspberry Pi 3B+


Solution

  • you install the module via pip3 so you need to run the script with python3 .

    like this: sudo python3 motortest.py