树莓派论坛

 找回密码
 立即注册

求教 DHT22新手

wearessweare 发表于 2021-1-27 12:18:50 | 显示全部楼层 |阅读模式
最近用树莓派4B 链接 DHT22读温湿度,但总是报错如下  这是怎么回事Python 3.7.3 (/usr/bin/python3)>>> %Run HVACDetectByDHT22.pyTraceback (most recent call last):  File "/home/pi/Adafruit_Python_DHT/HVACDetectByDHT22.py", line 4, in <module>    humidity,temperature=Adafruit_DHT.read_retry(Adafruit_DHT.DHT22,pin)  File "/home/pi/Adafruit_Python_DHT/Adafruit_DHT/common.py", line 94, in read_retry    humidity, temperature = read(sensor, pin, platform)  File "/home/pi/Adafruit_Python_DHT/Adafruit_DHT/common.py", line 80, in read    platform = get_platform()  File "/home/pi/Adafruit_Python_DHT/Adafruit_DHT/common.py", line 55, in get_platform    from . import Raspberry_Pi_2  File "/home/pi/Adafruit_Python_DHT/Adafruit_DHT/Raspberry_Pi_2.py", line 22, in <module>    from . import Raspberry_Pi_2_Driver as driverImportError: cannot import name 'Raspberry_Pi_2_Driver' from 'Adafruit_DHT' (/home/pi/Adafruit_Python_DHT/Adafruit_DHT/__init__.py)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版 | Archiver | 树莓派论坛 ( 粤ICP备15075382号-1 )