如何在树莓派上安装python和GPIO库
发布网友
发布时间:2022-04-20 16:10
我来回答
共1个回答
热心网友
时间:2022-04-07 11:29
不同操作系统安装GPIO的命令是不同的,这里以树莓派的官方操作系统Raspbian为例,说明如何安装GPIO库。
Raspbian中安装了两个Python版本,分别是2.7.3和3.2.2。Python2.x的安装包会一python为前缀,而Python3.x的安装包回忆python3为前缀。
Python2安装GPIO库需要输入命令:
sudo <a href="https://www.baidu.com/s?wd=apt-get&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dBrH9BPHczPA7bPWn4nWPh0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPjn1nH0znjb4nHmznWmknWfY" target="_blank"class="-highlight">apt-get</a> install python-rpi.gpio
Python3安装GPIO库需要输入命令:
sudo <a href="https://www.baidu.com/s?wd=apt-get&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dBrH9BPHczPA7bPWn4nWPh0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPjn1nH0znjb4nHmznWmknWfY" target="_blank"class="-highlight">apt-get</a> install python3-rpi.gpio