DHT22 Sensor import Adafruit_DHT error

FooLingYu2 picture FooLingYu2 · Oct 8, 2014 · Viewed 29.3k times · Source

So I've properly attached DHT22 Humidity Sensor to my BeagleBone Black Rev C. I'm running OS Mavericks on my MacBook Pro and I followed the directions provided by Adafruit on how to use my DHT22

The website I used was pretty clear: https://learn.adafruit.com/dht-humidity-sensing-on-raspberry-pi-with-gdocs-logging/software-install-updated

Also here is the github files I cloned: https://github.com/adafruit/Adafruit_Python_DHT

I put in these lines:

git clone https://github.com/adafruit/Adafruit_Python_DHT.git

cd Adafruit_Python_DHT

sudo apt-get upgrade

sudo apt-get install build-essential python-dev

sudo python setup.py install

cd examples

sudo ./AdafruitDHT.py 22 P8_11

I am successful until that last line. Once I enter that last line (sudo ./AdafruitDHT.py 22 P8_11), I get the following error message:

Traceback (most recent call last):
  File "./AdafruitDHT.py", line 23, in <module>
    import Adafruit_DHT
ImportError: No module named Adafruit_DHT

I know there is an Adafruit_DHT file somewhere because when I ls in the Adafruit_Python_DHT directory, I get this:

root@beaglebone:~/Adafruit_Python_DHT# ls
Adafruit_DHT  examples  ez_setup.py  ez_setup.pyc  LICENSE  README.md  setup.py  source

I've tried reinstalling the setup.py, but the outcome is still the same.

I've followed all the directions Adafruit provided, but I just can't seem to get past this. Any idea on what is going on? It seems like a simple problem, but it's proving to be one major obstacle in getting readings from my DHT22. If there is more information needed to help answer this problem please let me know.

Answer

ndb23 picture ndb23 · May 30, 2016

Easy fix:

cd Adafruit_Python_DHT

sudo apt-get update

sudo apt-get install build-essential python-dev python-openssl

sudo python setup.py install

Try to run sudo ./AdafruitDHT.py ## ## ... file again

You may have forgot to run the setup properly.