Jump to content

BananaPI M1 GPIO in Python 3


Recommended Posts

Im tring to access the GPIO using Python3 on a bananapi M1

Linux m5 4.19.38-sunxi #5.85 SMP Wed May 8 14:20:48 CEST 2019 armv7l GNU/Linux


I manage to get access to gpio in shell, c, and in python2, but not in python3 with the following software:





The error in python3 is the following (in pyhon2 work) :


Traceback (most recent call last):
File "/root/src/BPI-WiringPi2-Python/wiringpi2.py", line 18, in swig_import_helper
fp, pathname, description = imp.find_module('_wiringpi2', [dirname(__file__)])
File "/usr/lib/python3.5/imp.py", line 296, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_wiringpi2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "test.py", line 1, in <module>
import wiringpi2 as wiringpi
File "/root/src/BPI-WiringPi2-Python/wiringpi2.py", line 28, in <module>
_wiringpi2 = swig_import_helper()
File "/root/src/BPI-WiringPi2-Python/wiringpi2.py", line 20, in swig_import_helper
import _wiringpi2
ImportError: /usr/local/lib/python3.5/dist-packages/wiringpi2-1.1.1-py3.5-linux-armv7l.egg/_wiringpi2.cpython-35m-arm-linux-gnueabihf.so: undefined symbol: PyString_FromStringAndSize


After that I tryed the follow software and instructions:





In both i got the following error: 


root@m5:~/src/RPi.GPIO_BP/test# python3 led.py
BPI: gpioLayout(-1)
Traceback (most recent call last):
File "led.py", line 2, in <module>
import RPi.GPIO as GPIO
File "/usr/local/lib/python3.5/dist-packages/RPi/GPIO/__init__.py", line 23, in <module>
from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!


After I notice that in lemaker wiki was a BCM2835 lib modified to BP (but said bananapro).

I tried it anyway but altough compile without error, the test fail. (My banana is a M1 not a pro)


After I also tried the following software and instructions of the following link without sucess (python3): http://wiki.lemaker.org/LMK.GPIO. The return stop feeding a new line. Time to stop the post. howto bpi m2 python3 gpio? Tks for your time. Sergio

Link to comment
Share on other sites

After a lot of time around the subject i found that to use GPIO in python3 we need to install the:




But we need to install it before we try the sinovoip version.

If we install the sinovoip first an after that the lemaker version. It not work.


For C, shell and python2 we can use (it works):





tnks for the help



Link to comment
Share on other sites

This topic is now closed to further replies.
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines