我的剧本名为 serial.py 尝试导入pySerial:
serial.py
import serial ser = serial.Serial('/dev/ttyAMA0', 9600) ser.write("hello world!")
由于某种原因,它拒绝建立与此错误的串行连接:
AttributeError: 'module' object has no attribute 'Serial'
奇怪的是,它在几个小时前就开始工作了。
提前谢谢!