當前位置:成語大全網 - 新華字典 - 如何在樹莓派上安裝python和GPIO庫

如何在樹莓派上安裝python和GPIO庫

不同操作系統安裝GPIO的命令是不同的,這裏以樹莓派的官方操作系統Raspbian為例,說明如何安裝GPIO庫。

Raspbian中安裝了兩個Python版本,分別是2.7.3和3.2.2。Python2.x的安裝包會壹python為前綴,而Python3.x的安裝包回憶python3為前綴。

Python2安裝GPIO庫需要輸入命令:

sudo <a href="/s?wd=apt-get&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dBrH9BPHczPA7bPWn4nWPh0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPjn1nH0znjb4nHmznWmknWfY" target="_blank"class="baidu-highlight">apt-get</a> install python-rpi.gpio

Python3安裝GPIO庫需要輸入命令:

sudo <a href="/s?wd=apt-get&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dBrH9BPHczPA7bPWn4nWPh0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPjn1nH0znjb4nHmznWmknWfY" target="_blank"class="baidu-highlight">apt-get</a> install python3-rpi.gpio