为了账号安全,请及时绑定邮箱和手机立即绑定

无法从“Adafruit_DHT”导入名称“Beaglebone_Black_Driver”

无法从“Adafruit_DHT”导入名称“Beaglebone_Black_Driver”

鸿蒙传说 2023-04-25 17:38:17
我在 Raspberrypi 4B 4Gb 上运行最新的树莓派操作系统“Linux raspberrypi 5.4.51-v7l+ #1327 SMP Thu Jul 23 11:04:39 BST 2020 armv7l GNU/Linux”。我已经安装了 Python3 sudo apt-get install python3-dev python3-pip更新了设置工具、wheel 和 pip sudo python3 -m pip install --upgrade pip setuptools wheel并安装了 Adafruit_DHT 模块 sudo pip3 install Adafruit_DHT之后我将我的 DHT22 连接到 gpio4 上的 rpi 并创建了以下 python 脚本:import Adafruit_DHTimport timefrom datetime import datetimeDHT_SENSOR = Adafruit_DHT.DHT22DHT_PIN = 4PROBE_NAME = "PI4"humidity, temperature = Adafruit_DHT.read_retry(DHT_SENSOR, DHT_PIN)if humidity is not None and temperature is not None:    print("{2} - T={0:0.1f} H={1:0.1f}".format(temperature, humidity, datetime.now()))else:    print("Failed to retrieve data from humidity sensor")比我运行它 sudo python3 temp.py我收到以下错误Traceback (most recent call last):  File "temp.py", line 11, in <module>    humidity, temperature = Adafruit_DHT.read_retry(DHT_SENSOR, DHT_PIN)  File "/usr/local/lib/python3.7/dist-packages/Adafruit_DHT/common.py", line 94, in read_retry    humidity, temperature = read(sensor, pin, platform)  File "/usr/local/lib/python3.7/dist-packages/Adafruit_DHT/common.py", line 80, in read    platform = get_platform()  File "/usr/local/lib/python3.7/dist-packages/Adafruit_DHT/common.py", line 60, in get_platform    from . import Beaglebone_Black  File "/usr/local/lib/python3.7/dist-packages/Adafruit_DHT/Beaglebone_Black.py", line 24, in <module>    from . import Beaglebone_Black_Driver as driverImportError: cannot import name 'Beaglebone_Black_Driver' from 'Adafruit_DHT' (/usr/local/lib/python3.7/dist-packages/Adafruit_DHT/__init__.py)知道如何让它工作吗?我在树莓派零 w 上完成了完全相同的步骤,它开箱即用
查看完整描述

目前暂无任何回答

  • 0 回答
  • 0 关注
  • 151 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信