我有一些设备通过RS485 到 USB 转换器连接到我的笔记本电脑,并希望在 python 程序中检测它们。
我在Windows 7 Notebook 上使用PyCharm Community Edition运行此代码,我已经使用 pip 安装了 pyserial。
导入序列
x = list(serial.tools.list_ports.comports())
print(x)
Run Code Online (Sandbox Code Playgroud)
并得到这个错误:
回溯(最近一次调用):文件“C:/Users/rzzrgx/.PyCharmCE2018.3/config/scratches/scratch_1.py”,第 3 行,在 x = list(serial.tools.list_ports.comports()) AttributeError :模块“串行”没有属性“工具”