找不到端口:在python中列出所有端口时出错

问题描述

我尝试列出所有com端口,以便可以连接它们。我正在使用Ubuntu 20.04。我尝试了在stackoverflow上得到回答的各种方法。 我尝试从命令行output of the command line

列出
import serial
import serial.tools.list_ports
ports = serial.tools.list_ports.comports()
print(ports)
for port,desc,hwid in sorted(ports):
        print('hello')
        print("{}: {} [{}]".format(port,hwid))

serial.tools.list_ports.comports()方法返回一个空列表。 我尝试了一切,并用了很多Google工具,但找不到解决方案。 请帮助某人,因为否则,我的项目将停止。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)