0

这是我的代码:

import pyshark
cap = pyshark.LiveCapture(output_file='newOutput')

错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Python36\lib\site-packages\pyshark\capture\live_capture.py", line 57, in __init__
    self.interfaces = get_tshark_interfaces(tshark_path)
  File "C:\Program Files\Python36\lib\site-packages\pyshark\tshark\tshark.py", line 138, in get_tshark_interfaces
    parameters = [get_process_path(tshark_path), '-D']
  File "C:\Program Files\Python36\lib\site-packages\pyshark\tshark\tshark.py", line 98, in get_process_path
    'Search these paths: {}'.format(possible_paths)
pyshark.tshark.tshark.TSharkNotFoundException: TShark not found. Try adding its location to the configuration file. Search these paths: ['C:\\Program Files\\Wireshark\\tshark.exe', 'C:\\Program Files (x86)\\Wireshark\\tshark.exe', 'C:\\Program Files\\Wireshark\\tshark.exe']

我正在运行一台装有 python 3.6 的 Windows 10 机器。我已经安装了wireshark和tshark(但它不在它的默认文件夹中;我还在windows的系统变量中记录了它们的路径)

4

1 回答 1

0
sudo apt-get install tshark

为 Ubuntu 用户完成这项工作。由于您是 Windows 用户,因此您应该安装 tshark 软件包。

于 2019-12-16T07:19:19.597 回答