I am testing a DHT11 example code shown below and get this error message. But when trying to install this adafruit_dht I get this message in the terminal
Requirement already satisfied: adafruit_dht in /usr/local/lib/python3.7/dist-packages (1.4.0)
The example code
Requirement already satisfied: adafruit_dht in /usr/local/lib/python3.7/dist-packages (1.4.0)
The example code
Code:
import timeimport boardimport adafruit_dht# Initialize the DHT11 sensordhtDevice = adafruit_dht.DHT11(board.D17) # Change to your GPIO pinwhile True: try: # Read temperature and humidity temperature_c = dhtDevice.temperature humidity = dhtDevice.humidity print(f'Temp: {temperature_c:.1f}°C Humidity: {humidity}%') except RuntimeError as error: print(error.args[0]) time.sleep(2.0)Statistics: Posted by jfriberg — Mon Feb 09, 2026 11:09 pm