module ‘serial’ has no attribute ‘Serial’

root@raspberrypi:/home# python3
Python 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import serial
import pyserial
Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘pyserial’

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

pip uninstall serial
pip uninstall pyserial
pip install pyserial

你可能感兴趣的:(python,开发语言)