首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在Raspberry Pi 400上安装python Adafruit_DHT时出错

在Raspberry Pi 400上安装python Adafruit_DHT时出错
EN

Stack Overflow用户
提问于 2022-06-09 02:28:35
回答 1查看 621关注 0票数 1

我需要使用一个DHT-11的学校项目,我是一个奇怪的错误,试图安装它的软件包。

按照我使用的sudo pip3 install Adafruit_DHT的说明,结果得到了这个输出:

代码语言:javascript
运行
复制
sudo pip3 install Adafruit_DHT
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting Adafruit_DHT
  Using cached Adafruit_DHT-1.4.0.tar.gz (15 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: Adafruit_DHT
  Building wheel for Adafruit_DHT (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      Could not detect if running on the Raspberry Pi or Beaglebone Black.  If this failure is unexpected, you can run again with --force-pi or --force-bbb parameter to force using the Raspberry Pi or Beaglebone Black respectively.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for Adafruit_DHT
  Running setup.py clean for Adafruit_DHT
Failed to build Adafruit_DHT
Installing collected packages: Adafruit_DHT
  Running setup.py install for Adafruit_DHT ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for Adafruit_DHT did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      Could not detect if running on the Raspberry Pi or Beaglebone Black.  If this failure is unexpected, you can run again with --force-pi or --force-bbb parameter to force using the Raspberry Pi or Beaglebone Black respectively.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> Adafruit_DHT

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

我还尝试运行sudo pip3 install Adafruit_DHT --install-option="--force-pi",它的输出是:

代码语言:javascript
运行
复制
WARNING: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting Adafruit_DHT
  Using cached Adafruit_DHT-1.4.0.tar.gz (15 kB)
  Preparing metadata (setup.py) ... done
Skipping wheel build for Adafruit_DHT, due to binaries being disabled for it.
Installing collected packages: Adafruit_DHT
  Running setup.py install for Adafruit_DHT ... done
Successfully installed Adafruit_DHT
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

然而,当我运行我的python代码时,我得到了以下内容

代码语言:javascript
运行
复制
  import Adafruit_DHT
ModuleNotFoundError: No module named 'Adafruit_DHT'

我已经更新了pip和安装工具,我对所有这些都很陌生。这项任务很快就要完成了,我只想让这个DHT开始工作。提前谢谢。

EN

回答 1

Stack Overflow用户

发布于 2022-07-11 06:54:01

当我试图在py上安装Adafruit_DHT时,我也遇到了同样的问题。

当我重新安装轮子时:

代码语言:javascript
运行
复制
sudo python3 -m pip install --upgrade pip setuptools wheel

然后:

代码语言:javascript
运行
复制
sudo pip3 install Adafruit_DHT

对我起作用了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72554099

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档