【发布时间】:2014-03-17 23:44:20
【问题描述】:
我无法列出可用的串行端口,我真的需要帮助来调试它。 在 Python 2.7.5 中,COM 端口正确列出,而 PySerial 在 Python 3.3.5 中返回一个空列表。
我在互联网上发现另一个孤独的灵魂有同样的问题(没有答案),但这个问题似乎一点也不流行——也许是我的系统?
我使用的是 Mac OS X 10.9.2,并通过自制软件安装了 python 和 python3。我刚刚更新了所有内容。 PySerial 在 pip 和 pip3 中都是 2.7 版。
输出:
Python 2.7.5 (default, Nov 4 2013, 18:04:45)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from serial.tools import list_ports
>>> list_ports.comports()
[['/dev/cu.Bluetooth-Incoming-Port', 'n/a', 'n/a'], ['/dev/cu.Bluetooth-Modem', 'n/a', 'n/a']]
Python 3.3.5 (default, Mar 10 2014, 13:25:50)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from serial.tools import list_ports
>>> list_ports.comports()
[]
【问题讨论】:
-
我对 pyserial 也有同样的问题。 Python 3.4.1,OSX 10.9。总是返回空列表。找到解决方案了吗?
-
你可以在问题的底部找到我的修复。
-
@Thomas 您的编辑很有用:您应该考虑重写它作为您自己问题的答案!
标签: macos python-3.x pyserial