AttributeError: module ‘serial‘ has no attribute ‘Serial‘

AttributeError: module ‘serial’ has no attribute ‘Serial’

AttributeError: module ‘serial’ has no attribute ‘Serial’

运行python的时候出现AttributeError: module ‘serial’ has no attribute ‘Serial’,我用的是pyCharm,原因可能是pyserial安装错误,找到python安装目录:
File --》Settings --》project:untitled --》
AttributeError: module ‘serial‘ has no attribute ‘Serial‘_第1张图片

点击show ALL
AttributeError: module ‘serial‘ has no attribute ‘Serial‘_第2张图片
找到你使用的python版本在后面的目录中找到pyvenv.cfg文件
AttributeError: module ‘serial‘ has no attribute ‘Serial‘_第3张图片
用记事本打开pyvenv.cfg文件,找到home目录,找到该目录
AttributeError: module ‘serial‘ has no attribute ‘Serial‘_第4张图片
再往里追两级,我的版本实例:C:\Users\win 10\AppData\Local\Programs\Python\Python37\Lib\site-packages
AttributeError: module ‘serial‘ has no attribute ‘Serial‘_第5张图片
在此文件夹中找到所有serial的文件删掉,然后再重装pyserial就可使用了!!!
AttributeError: module ‘serial‘ has no attribute ‘Serial‘_第6张图片

你可能感兴趣的:(serial,error,python)