Adafruit_bmp in python 3

Asked

Viewed 23 times

0

I am testing the BMP180 sensor on Raspberrypi 3 B+ and when I run the file on Raspbian gives me this error:

inserir a descrição da imagem aqui

when I run the same file from the command line it gives the values it should give, no error, as you can see from the following image:

inserir a descrição da imagem aqui

what could be happening to make this mistake?

  • Friend, I advise to ask this question in another community geared towards Raspberry-pi. Here is geared towards programming.

  • 2

    In the first image is running on Python3+ and in the second on Python2+, see if the module is installed on Python3+ as well.

1 answer

0


Modules are not shared between Python versions.

By default, in Raspbian the command python points to Python version 2.7. You can confirm this via the second line of your terminal image

Python 2.7.13 (default, Nov 24 2017, 17:33:09)

Already, when running on IDLE, you are running on version 3.5.3, see the first line that appears in the program

Python 3.5.3 (default, Jan 19 2017, 14:11:04)

That is, you have the module Adafruit_BMP installed correctly in version 2.7, but not in 3.5. Just see which one you will use. If it is 2.7, you will need to open IDLE in this version as well, but if it is 3.5, you will have to install the module in this version.

  • OK, and where can I get this library for version 3.5?

  • Probably in the official repository.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.