importing dht11 Adafruit python

大兔子大兔子 提交于 2020-01-07 04:30:08

问题


I'm having some difficulties importing the module dht11 from the Adafruit library(https://github.com/adafruit/Adafruit_Python_DHT). I'm using a raspberry pi3 model b, and have installed python 3.5. I downloaded the Adafruit and installed using

sudo python3 setup.py install

and I'm fairly certain that the installation went well since I connected my temp and humidity sensor and using

sudo python3 examples/AdafruitDHT.py 11 2

I get correct reading about temp and humidity, yet when I try to import the dht11 module (I'm using spyder as ide) I get the 'no module named dht11'. I tried appending the directory in the sys.path but still get the same error.

Edit: I tried both python 2 and 3, get the same error

Edit2: I tried other IDE as well, but no one is working. I opted to launch the script.py directly from terminal since this way it's working. If anyone has a solution, it would be greatly appreciated.

来源:https://stackoverflow.com/questions/46630060/importing-dht11-adafruit-python

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!