我自己解决了这个问题。 你必须使用操作系统库
例子:
import os file = os.open('filename', os.O_RDWR) #Write byte 0x1 to SPI Bus os.write(file, chr(0x1)) #Read one byte from SPI Bus print(str(ord(os.read(file, 1))))