When I updated from Python 2.7.3 to 2.7.10 on Raspbian wheezy, I could no longer import smbus.

Asked 2 years ago, Updated 2 years ago, 90 views

Thank you for your help.
I updated Raspbian wheezy's Python 2.7.3 to 2.7.10 by following the steps below.

wget-c https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
tar-xzvf Python-2.7.10.tgz
cd Python-2.7.10/
LDFLAGS="-L/usr/lib/x86_64-linux-gnu"./configure
make
sudo make install

After the update, I ran a .py file that worked fine in 2.3.7, and Python started to throw out errors when smbus was not found.Again

 sudo apt-get install build-essential libi2c-devi2c-tools python-dev libffi-dev
pip install cffi
pip install smbus-cffi

I tried to install the smbus module using the above steps, but Python still gives an error when the smbus is not found.
How can I get Python to recognize smbus normally?
Thank you for your advice.

python raspberry-pi raspbian

2022-09-29 22:18

1 Answers

Installing python-smbus with apt makes smbus available from Raspbian standard Python 2.7

The smbus module installed with apt will be installed in /usr/lib/python 2.7/dist-packages/smbus.so, so it should not be available from Python 2.7.10 installed separately.

There are several possible ways to use smbus.so installed in apt from Python installed separately.


2022-09-29 22:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.