I'm trying to follow the instructions for: https://learn.adafruit.com/adafruit-16x ... y-pi/usage
I'm running Python 2.7.5
Raspberry Pi: 512
When I run: sudo i2cdetect -y 1 it shows 20: 20 and everything looks fine.
When I run: sudo python Adafruit_CharLCDPlate.py
I get the following error:
Traceback (most recent call last):
File "Adafruit_CharLCDPlate.py", line 11, in <module>
from Adafruit_I2C import Adafruit_I2C
File "/home/pi/Adafruit-Raspberry-Pi-Python-Code/Adafruit_CharLCDPlate/Adafruit_I2C.py", line 3, in <module>
import smbus
ImportError: No module named smbus
I have run: sudo apt-get install python-smbus and it says that it was already installed.
When I run: pydoc smbus
it says: no Python documentation found for 'smbus'
Can anyone explain to me what I need to do to fix this error?
Thanks,
jk
ImportError: No module named smbus
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- codehub
- Posts: 5
- Joined: Wed Mar 19, 2014 6:06 am
Re: ImportError: No module named smbus
simple fix.
$sudo python2.6 /path/to/python/file.py
Thanks anyway.
jk
$sudo python2.6 /path/to/python/file.py
Thanks anyway.
jk
-
- Posts: 4
- Joined: Tue Apr 01, 2014 1:34 pm
Re: ImportError: No module named smbus
im having the same issue, how exactly did you fix this? when I run the line you posted i get "command not found"
- codehub
- Posts: 5
- Joined: Wed Mar 19, 2014 6:06 am
Re: ImportError: No module named smbus
What version of Python are you running?
-
- Posts: 4
- Joined: Tue Apr 01, 2014 1:34 pm
Re: ImportError: No module named smbus
Im running python 2, i dont know the exact version until I can get home and check this evening. Ill update.
-
- Posts: 4
- Joined: Tue Apr 01, 2014 1:34 pm
- codehub
- Posts: 5
- Joined: Wed Mar 19, 2014 6:06 am
Re: ImportError: No module named smbus
Ok, a few things to try:
$ sudo apt-get update
$ sudo apt-get upgrade
Then
$ sudo apt-get install python-dev python-smbus
Let me know if that helps.
$ sudo apt-get update
$ sudo apt-get upgrade
Then
$ sudo apt-get install python-dev python-smbus
Let me know if that helps.
-
- Posts: 4
- Joined: Tue Apr 01, 2014 1:34 pm
Re: ImportError: No module named smbus
that did help, now Im just getting errors acessing my I2C addressed, I might have the accelerometer hooked up wrong tho. Thanks!
- RossU
- Posts: 15
- Joined: Tue Jun 21, 2016 2:28 pm
Re: ImportError: No module named smbus
I did the sudo get-apt install described but it is a Python 2 module and I´m using a python 3 so it isn´t updating the correct development environment. Is there an equivalent package for python 3?
Please be positive and constructive with your questions and comments.