5

I'm trying to use the module 'smbus' on python3. I've downloaded it - when I try to download smbus, it says that smbus is up to date and installed. However, when I try to use it, it says the module is not found. I've found a similar problem with pip3. It's downloaded but pip is an unrecognized command. Thank you!

EDIT 1: I think this is because of a mix up of Python 2/3

EDIT 2: when I run apt-cache search smbus, I get:

pi@raspberrypi ~ $ apt-cache search smbus
python-smbus - Python bindings for Linux SMBus access through i2c-dev
pypy-smbus-cffi - This Python module allows SMBus access through the I2C /dev
python3-smbus - Python 3 bindings for Linux SMBus access through i2c-dev

EDIT 3: I downloaded smbus by:

sudo apt-get update
sudo apt-get install -y python3-smbus
MatsK
  • 2,882
  • 3
  • 17
  • 22
Issac Jacob
  • 51
  • 1
  • 1
  • 3

1 Answers1

3

Sounds like you are only downloading modules and not installing them. Here's how to do it.

  1. Installing pip: sudo apt-get install python-pip python3-pip

  2. Installing smbus: sudo apt-get install python-smbus python3-smbus python-dev python3-dev

tlhIngan
  • 3,372
  • 5
  • 21
  • 33