我需要使用一个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开始工作。提前谢谢。
发布于 2022-07-11 06:54:01
当我试图在py上安装Adafruit_DHT时,我也遇到了同样的问题。
当我重新安装轮子时:
sudo python3 -m pip install --upgrade pip setuptools wheel
然后:
sudo pip3 install Adafruit_DHT
对我起作用了。
https://stackoverflow.com/questions/72554099
复制相似问题