UV0*_*UV0 4 error-handling raspberrypi 20.10
我试图在带有 ubuntu 20.10 桌面的树莓派 4 上安装 rpi.gpio,如下所示
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python-pip python-dev
Run Code Online (Sandbox Code Playgroud)
它给出了
note, selecting 'python-dev-is-python2' instead of 'python-dev'
Package python-pip is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
python3-pip
Run Code Online (Sandbox Code Playgroud)
所以我试过了
sudo apt-get install python3-pip python-dev
Run Code Online (Sandbox Code Playgroud)
正常安装它但是然后,对于
sudo pip install RPi.GPIO
Run Code Online (Sandbox Code Playgroud)
这给出了非常大的错误作为开始
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-00y2fso0/RPi.GPIO/setup.py'"'"'; __file__='"'"'/tmp/pip-install-00y2fso0/RPi.GPIO/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-m2w0m0n7
cwd: /tmp/pip-install-00y2fso0/RPi.GPIO/
Run Code Online (Sandbox Code Playgroud)
并以
collect2: error: ld returned 1 exit status
error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for RPi.GPIO
Run Code Online (Sandbox Code Playgroud)
它再次运行设置为
Running setup.py clean for RPi.GPIO
Failed to build RPi.GPIO
Installing collected packages: RPi.GPIO
Running setup.py install for RPi.GPIO ... error
Run Code Online (Sandbox Code Playgroud)
失败
error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-00y2fso0/RPi.GPIO/setup.py'"'"'; __file__='"'"'/tmp/pip-install-00y2fso0/RPi.GPIO/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-u3ttxsed/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/RPi.GPIO
Check the logs for full command output.
Run Code Online (Sandbox Code Playgroud)
我在某处找到了这个并尝试过
sudo apt install rpi.gpio-common
Run Code Online (Sandbox Code Playgroud)
安装正常,请帮我解决这个错误,如果是的话,我可以使用这个'rpi.gpio-common'来控制gpio引脚吗?谢谢你的时间。
小智 5
我能够通过RPi.gpio使用安装来解决这个问题pip3。键入以下命令:
export CFLAGS=-fcommon
pip3 install RPi.GPIO
Run Code Online (Sandbox Code Playgroud)
来源:https : //www.raspberrypi.org/forums/viewtopic.php?t=289084
小智 1
从版本 20.10 开始,Ubuntu 并未安装 Python 2,因为它已被弃用。它确实有 python 3。您可以使用 python3 来运行 python,使用 pip3 来安装模块。
小智 0
免责声明: 我对使用 Ubuntu/Linux 和 Raspberry Pi 还很陌生,所以我对这些系统或为什么事情以某种方式工作并不是非常了解。不过,我会尝试一下,因为我没有看到任何其他答案,而且我也遇到了同样的问题。
长话短说
尝试:
sudo apt-get install RPi.GPIO
Run Code Online (Sandbox Code Playgroud)
我认为这可能与 pip 由于某种原因无法工作有关。
背景
因此,作为背景,我有一个在 Raspbian 操作系统上运行的 python 脚本,用于测量 CPU 温度并使用 GPIO 引脚控制一些 LED,但我需要一个 64 位操作系统来运行某些软件,最终选择了 lubuntu。
我做了几乎所有与你相同的步骤,并且出现了相同的错误。我认为这与 pip 有关,因为一旦我运行了上面的命令,它就开始工作了。
| 归档时间: |
|
| 查看次数: |
3918 次 |
| 最近记录: |