Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/309.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在python上导入pcap或pyshark_Python_Python 2.7_Import_Capture_Ethernet - Fatal编程技术网

如何在python上导入pcap或pyshark

如何在python上导入pcap或pyshark,python,python-2.7,import,capture,ethernet,Python,Python 2.7,Import,Capture,Ethernet,我想在使用python时编写以太网数据包捕获。 我在谷歌上搜索发现我应该使用Pcap库或PyShark,但我尝试导入Pcap,它说找不到模块名Pcap,所以我尝试使用PyShark实例,但在Python shell上显示如下 Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> import pyshark File "D:\Python27\lib\site-

我想在使用python时编写以太网数据包捕获。 我在谷歌上搜索发现我应该使用Pcap库或PyShark,但我尝试导入Pcap,它说找不到模块名Pcap,所以我尝试使用PyShark实例,但在Python shell上显示如下

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    import pyshark
  File "D:\Python27\lib\site-packages\pyshark-0.3.3-py2.7.egg\pyshark\__init__.py", line 1, in <module>
    from pyshark.capture.live_capture import LiveCapture
  File "D:\Python27\lib\site-packages\pyshark-0.3.3-py2.7.egg\pyshark\capture\live_capture.py", line 1, in <module>
    from pyshark.capture.capture import Capture
  File "D:\Python27\lib\site-packages\pyshark-0.3.3-py2.7.egg\pyshark\capture\capture.py", line 7, in <module>
    import trollius as asyncio
ImportError: No module named trollius
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
进口皮沙克
文件“D:\Python27\lib\site packages\pyshark-0.3.3-py2.7.egg\pyshark\\uuuu init\uuuu.py”,第1行,在
从pyshark.capture.live\u捕获导入LiveCapture
文件“D:\Python27\lib\site packages\pyshark-0.3.3-py2.7.egg\pyshark\capture\live\u capture.py”,第1行,在
从pyshark.capture.capture导入捕获
文件“D:\Python27\lib\site packages\pyshark-0.3.3-py2.7.egg\pyshark\capture\capture.py”,第7行,在
以异步方式导入trollius
ImportError:没有名为trollius的模块
关于这个问题,我该怎么办? 如何将库导入python


操作系统是Windows 8.1和Python 2.7.9版

项目要求为Python 3.4之前的Python版本安装pyshark。你需要单独安装

但是,它应该在安装
pyshark
软件包时安装。确保始终使用像
pip
这样的工具来安装软件包,这样的依赖项会自动得到处理;
pyshark
项目:


@Cashchii:因为这是Python2.7.9,所以您可以使用
Python-m pip安装trollius
。要安装控制盘,首先需要安装
控制盘
支持:
python-m pip安装控制盘
我尝试安装“trollius”,但它如下图所示>>我尝试安装pip,然后安装pycap,但我得到了这样的图片,这是什么意思?我不确定。@Cashchii:该库正在尝试编译C扩展名,但找不到编译所需的头文件。@Cashchii:项目存储库中有。要在Windows上编译,您需要一个编译器(与Python版本兼容的Microsoft Visual Studio)和带有开发头的winpcap。
install_requires=['lxml', 'py', 'trollius', 'logbook'],