DHT22 Sensor import Adafruit_DHT error

2024/9/22 12:54:38

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.gitcd Adafruit_Python_DHTsudo apt-get upgradesudo apt-get install build-essential python-devsudo python setup.py installcd examplessudo ./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

Easy fix:

cd Adafruit_Python_DHTsudo apt-get updatesudo apt-get install build-essential python-dev python-opensslsudo python setup.py install

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

You may have forgot to run the setup properly.

https://en.xdnf.cn/q/71944.html

Related Q&A

Whats the purpose of package.egg-info folder?

Im developing a python package foo. My project structure looks like this:. ├── foo │ ├── foo │ │ ├── bar.py │ │ ├── foo.py │ │ ├── __init__.py │ ├── README.md …

Implement Causal CNN in Keras for multivariate time-series prediction

This question is a followup to my previous question here: Multi-feature causal CNN - Keras implementation, however, there are numerous things that are unclear to me that I think it warrants a new quest…

How to decode a numpy array of dtype=numpy.string_?

I need to decode, with Python 3, a string that was encoded the following way:>>> s = numpy.asarray(numpy.string_("hello\nworld")) >>> s array(bhello\nworld, dtype=|S11)I tri…

Cosine similarity of word2vec more than 1

I used a word2vec algorithm of spark to compute documents vector of a text. I then used the findSynonyms function of the model object to get synonyms of few words. I see something like this: w2vmodel.f…

Handling empty case with tuple filtering and unpacking

I have a situation with some parallel lists that need to be filtered based on the values in one of the lists. Sometimes I write something like this to filter them:lista = [1, 2, 3] listb = [7, 8, 9] f…

pip3 install pyautogui fails with error code 1 Mac OS

I tried installing the autogui python extension:pip3 install pyautoguiAnd this installation attempt results in the following error message:Collecting pyautoguiUsing cached PyAutoGUI-0.9.33.zipComplete …

BERT get sentence embedding

I am replicating code from this page. I have downloaded the BERT model to my local system and getting sentence embedding. I have around 500,000 sentences for which I need sentence embedding and it is t…

Python Subversion wrapper library

In Subversions documentation theres an example of using Subversion from Python#!/usr/bin/python import svn.fs, svn.core, svn.reposdef crawl_filesystem_dir(root, directory):"""Recursively…

How to convert a selenium webelement to string variable in python

from selenium import webdriver from time import sleep from selenium.common.exceptions import NoSuchAttributeException from selenium.common.exceptions import NoSuchElementException from selenium.webdriv…

Why are session methods unbound in sqlalchemy using sqlite?

Code replicating the error:from sqlalchemy import create_engine, Table, Column, Integer from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmakerBase = declarative…