小编Jer*_*how的帖子

psutil.net_connections() 对于 OSX 不可用吗?

我试图在我的 OS X (12.1) Macbook Pro 上用 python 运行 psutil.net_connections() ,但遇到了 syscall failed 错误。这很奇怪,因为 psutil 的大多数其他功能都工作正常,没有任何问题,但不知何故 net_connections 似乎是唯一不工作的功能。

Python 3.8.9 (default, Oct 26 2021, 07:25:53) 
[Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
>>> psutil.net_connections(kind='tcp')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/mastermi/Library/Python/3.8/lib/python/site-packages/psutil/__init__.py", line 2161, in net_connections
    return _psplatform.net_connections(kind)
  File "/Users/mastermi/Library/Python/3.8/lib/python/site-packages/psutil/_psosx.py", line 248, in net_connections
    cons = Process(pid).connections(kind)
  File "/Users/mastermi/Library/Python/3.8/lib/python/site-packages/psutil/_psosx.py", line 343, in wrapper
    return fun(self, …
Run Code Online (Sandbox Code Playgroud)

python macos psutil

11
推荐指数
1
解决办法
734
查看次数

标签 统计

macos ×1

psutil ×1

python ×1