chaoshu的个人博客分享 http://blog.sciencenet.cn/u/chaoshu

博文

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

已有 5228 次阅读 2021-3-2 21:38 |个人分类:IoT|系统分类:科研笔记

错误信息:

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的时候需要选择好串口号等信息,并连接好串口。




https://blog.sciencenet.cn/blog-858128-1274693.html

上一篇:GMAIT基线解算脚本
下一篇:AttributeError: \'NoneType\' object has no attribute \'encode\'
收藏 IP: 171.113.113.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-5-16 07:21

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部