这是我的代码:
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的系统变量中记录了它们的路径)
sudo apt-get install tshark为Ubuntu用户完成了工作,因为您是Windows用户,所以应该安装tshark软件包。