GPIO模块调用错误



  • pi@raspberrypi:~/python $ sudo python robot.py
    Traceback (most recent call last):
      File "robot.py", line 1, in <module>
        import RPIO as GPIO
      File "/usr/local/lib/python2.7/dist-packages/RPIO/__init__.py", line 115, in <module>
        import RPIO._GPIO as _GPIO
    SystemError: This module can only be run on a Raspberry Pi!~~
    

  • administrators

    这是因为树莓派3代板子在python2版本的RPIO库不支持,可以用其他库替换此库即可。编辑文件:

    #删除下面的
    import RPIO as GPIO
    #添加
    import RPi.GPIO as GPIO
    

    注意大小写。


登录后回复

Looks like your connection to 首页 was lost, please wait while we try to reconnect.