python-problem solving: AttributeError: module'serial' has no attribute'Serial'

problem

I have installed the serial and pyserial libraries, but the running code still reports errors.
Insert picture description here

Check whether it is installed and found that there is no problem.
Insert picture description here

Solution

Uninstall both libraries and install only pyserial.

pip uninstall serial
pip uninstall pyserial
pip install pyserial

Run the code again, the problem is solved:

Insert picture description here

Reference article:

Guess you like

Origin blog.csdn.net/qq_45779334/article/details/113091042