module ‘serial’ has no attribute ‘Serial’

module ‘serial’ has no attribute ‘Serial’

问题代码:

import serial  # 导入pyserial
com = serial.Serial('com3', 115200)  # 实例化串口,com3,波特率115200

报错:module ‘serial’ has no attribute ‘Serial’
解决办法:1、卸载serial;2、卸载pyserial;3、重新打开你的编辑器。

pip uninstall serial
pip uninstall pyserial
pip install pyserial

你可能感兴趣的:(python,串口通信)