AttributeError: module 'serial' has no attribute 'Serial' solution

When I used the serial module, I encountered

module 'serial' has no attribute 'Serial'

Such a mistake, I checked the Internet, some people said that it is because the py file name is "serial.py", but my py file is not the name, and there is no error in the installation. So I uninstalled and installed it again, and it worked!

Command window input:

pip3 uninstall serial

and

pip3 uninstall pyserial

Uninstall, and then enter:

pip3 install serial 

Then enter:

pip3 install pyserial

After reinstalling it again, you can continue to use it!

Guess you like

Origin blog.csdn.net/ChenWenHaoHaoHao/article/details/130328922