Comments (11)
There should be no need to, smbus works fine under Python3.
There was a brief point a few years ago where it didn't.
The module is happily working on IDLE3 (from the same folder) on current Raspbian (Python3.5)
I've not checked for any maths errors, it didn't like the commenting the top though.
from mpu6050.
If you have problems with smbus not being recognised, then you can use pip3 to install smbus2 then manually change the import in the smbus import statement in the mpu6050.py file to import smbus2 as smbus. So summary:
- (install smbus2 through pip3) pip3 install smbus2
- (check that python3 can import smbus2)
- python3
- import smbus2
- exit()
- (change the import statement in the mpu6050.py file, it's location is in the 'no nodule named smbus' error message. It's often in site-packages/mpu6050/mpu6050.py) Change:
import smbus
TO
import smbus2 as smbus
hope this helps people..
from mpu6050.
There should be no need to, smbus works fine under Python3.
There was a brief point a few years ago where it didn't.
As far as I know, the python-smbus
package explicitly requires a python version <2.8; and thus doesn't support python3.
from mpu6050.
from mpu6050.
any update on this?
from mpu6050.
any update on this?
There's a python3-dev branch which should work with smbus2, but I haven't been able to test it yet.
from mpu6050.
from mpu6050.
It works with Python3. What's the problem you are seeing?
I haven't really had time to work on this project lately, but luckily the code generally seems to work so it's not really needed. However, last time I tried to use it I got some I/O errors, so I assume that there's something wrong with my sensor or with my Raspberry Pi (or the wires in between them).
from mpu6050.
Just a syntax error found on the python3-dev
setup.py
on line 25 a missing comma at the end. With that fix it works. I don't think this needs a PR but if needed I'll do it.
from mpu6050.
Thanks for the heads up about the missing comma @Bernix01, I fixed it in commit 20351ad.
from mpu6050.
So I finally found some time to test it. Here are the results:
- The regular branch seems to work fine in python3 when the
python3-smbus
package is installed. I guess I had an outdated version of Raspbian the last time I worked on this project, because I don't remember ever having that package. - The current
python3-dev
branch works with the smbus2 package. I'll rename the branch tosmbus2
for those who rather want to use smbus2.
So, as a conclusion: python2 and python3 are now supported. I'll make a new release (1.1) with an updated README shortly.
from mpu6050.
Related Issues (20)
- Getting Tracebacks on calling get_accel_data() HOT 4
- 'module' object is not callable HOT 12
- no checking connectivity HOT 2
- Gyro and accelerometer range HOT 3
- AttributeError: 'int' object has no attribute 'read_i2c_word' HOT 1
- FileNotFoundError: [Errno 2] No such file or directory HOT 1
- OSError: [Errno 121] Remote I/O error HOT 10
- Raspberry Pi - No Accelerometer Data Detected HOT 2
- ModuleNotFoundError when importing mpu6050 HOT 6
- Only zeros HOT 1
- Documentation overhaul HOT 1
- TypeError: 'module' object is not callable HOT 1
- OS Error : [Errorno 121] Remote I/O error HOT 6
- MODULE ERROR HOT 1
- Wrong question sorry delete
- Ask HOT 6
- accelometer data
- OSError: 121 HOT 1
- Init_py Type error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mpu6050.