Python “AttributeError: module ‘serial‘ has no attribute ‘Serial‘“串口问题

#Python "AttributeError: module ‘serial’ has no attribute ‘Serial’"串口问题
##源代码ser = serial.Serial(serialPort, baudRate, stopbits=serial.STOPBITS_TWO, timeout=0.5)

原因:安装串口工具包时,只安装了serial
解决:

pip install serial
pip install pyserial

再次运行源代码,问题解决!

可以正常使用python串口

猜你喜欢

转载自blog.csdn.net/qq_31460605/article/details/123370081