【发布时间】:2022-06-12 08:17:38
【问题描述】:
我需要将 DHT-11 用于学校项目,但在尝试为其安装软件包时遇到了一个奇怪的错误。
按照我使用 sudo pip3 install Adafruit_DHT 的说明进行操作,结果如下:
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",输出:
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 代码时,我得到了这个
import Adafruit_DHT
ModuleNotFoundError: No module named 'Adafruit_DHT'
我已经更新了 pip 和设置工具,而且我对这一切都很陌生。这项任务很快就要到期了,我只想让这个 DHT 工作。提前致谢。
【问题讨论】:
标签: python raspberry-pi raspberry-pi4