Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1251

Python • How to install dht22 (am2302) digital temperature humidity sensor on raspberry pi3

$
0
0
Hello people, I am trying to setup a dht22 (am2302) digital temperature humidity sensor on raspberry pi3 so the temperature and Humidity is displayed on a GUI configured on a touchscreen display project I am working on. I am not looking for code to include for the GUI, but how to actually setup the (am2302) on the pi3 with the library.

The library is DEPRECATED for Adafruit Python DHT Sensor.
So I can't install the library and use import Adafruit_DHT in my code because of it...

I tried Installing the library via: sudo pip3 install adafruit-circuitpython-dht, but I am getting this error:

error: externally-managed-environment

This environment is externally managed
To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

For more information visit http://rptl.io/venv

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.



I am on Python 3.11.2 and the temperature/humidity sensor is connected to GPIO 4.
How do install the library for this?

Is there a workaround to get that sensor to work on my pi?
Please provide step by step instructions as I am not to good in coding.

Cheers

Statistics: Posted by papagino — Tue Apr 01, 2025 9:09 pm



Viewing all articles
Browse latest Browse all 1251

Trending Articles