安装RPi.GPIO的问题

时间:2015-11-07 20:28:35

标签: python raspberry-pi raspbian gpio

我正在尝试安装RPi.GPIO,每次运行sudo python setup.py install时都会在我的控制台上遇到这些消息:

source/c_gpio.c:99:13: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
                 fgets(buffer, sizeof(buffer), fp);

source/c_gpio.c:116:15: warning: ‘peri_base’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     gpio_base = peri_base + GPIO_BASE_OFFSET;

source/cpuinfo.c:41:7: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
       fgets(buffer, sizeof(buffer), fp);

source/event_gpio.c:75:5: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
     write(fd, str_gpio, len);

当我尝试将RPi.GPIO导入python文件时,我收到一条错误消息,指出没有名为GPIO的模块。有谁知道任何解决方案?

1 个答案:

答案 0 :(得分:0)

您应该在终端中运行以下命令来安装包含 RPiGPIO 模块:pip3 install rpi-gpio

这些命令将下载并安装 RPi 模块。