如何修复这个 pyshark 错误:pyshark.tshark.tshark.TSharkNotFoundException?

问题描述

我想运行这段代码

import pyshark

file_path = '/Users/name/Desktop/exmp.pcapng'

cap = pyshark.FileCapture(file_path)
print(cap[0])

但是,我收到此消息:

pyshark.tshark.tshark.TSharkNotFoundException: TShark not found. Try adding its location to the configuration file. Searched these paths: ['C:\\Program Files\\Wireshark\\tshark.exe','/usr/bin/tshark','/bin/tshark','/usr/sbin/tshark','/sbin/tshark']

如果我在终端上搜索路径,这就是我得到的:

echo $PATH
/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS
  • 所有 tshark 命令都在终端上运行。

如何将tshark路径改为wireshark的路径?

解决方法

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

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

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