我正在关注 How to use the Raspberry Pi GPIO headers with ubuntu 上的教程其中一个步骤是使用安装 python3-lgpio
sudo apt install python3-lgpio
我得到 E: Unable to locate package python3-lgpio
作为结果。我尝试手动定位包裹from here并使用
sudo dpkg -i python3-lgpio
手动安装我得到dpkg: dependency problems prevent configuration of python3-lgpio:
python3-lgpio depends on python3 (>= 3.9~); however:
Version of python3 on system is 3.8.2-0ubuntu2.
然而,做 python -V
输出 Python 3.9.10
因为我之前在 Pi 上更新了 python。
最佳答案
我也遇到了这个问题,最终得到了一个丑陋的解决方案。我加载了 RPi.GPIO ( https://pypi.org/project/RPi.GPIO/ ) 并按照 https://sourceforge.net/p/raspberry-gpio-python/wiki/BasicUsage/ 的使用说明进行操作
我能够使用 IDLE 打开和关闭 LED。我确实必须使用 sudo 安装模块并使用 sudo 运行 IDLE。呸!绝对是一个 hack,我会关注这个,看看是否有人有更好、更正确的方法来访问 20.04 中的 GPIO。
关于ubuntu - 如何在树莓派上的 Ubuntu 20.04 上安装 python3-lgpio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70903849/