||
错误信息:
AttributeError: module 'serial' has no attribute 'Serial'
解决:
https://blog.csdn.net/m0_37827405/article/details/80879678
遇到该问题正常有两种情况:
(1)你的文件名serial.py和引入的第三方库名字重复了,解决方法:重命名文件名
(2)你没有安装第三方库文件,解决方法,pip install serial 之后 pip install pyserial
(3)可能由于网络原因没有安装好,解决方法,卸载之后重新安装两个第三方库文件:pip uninstall serial 和pip uninstall pyserial,卸载之后就可以重新安装
这里检查是否安装完成可以查看E:\你自己的文件路径\python\project\Lib\site-packages 是否存在serial文件夹,然后检查
C:\Users\cugch\AppData\Local\Programs\Python\Python39\Lib\site-packages\serial文件夹里面是否有
__init__.py
serialutil.py
serialwin32.py
三个文件,如果以上都有,则安装成功。
最后切记运行demo的时候需要选择好串口号等信息,并连接好串口。
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-10-20 03:06
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社