I am trying to install pcapy on a Windows machine. I have already installed WinPcap 4.1.3
我正在试着在Windows机器上安装pcapy。我已经安装了WinPcap 4.1.3。
I downloaded pcapy 0.10.8 into C:\pcapy-0.10.8
我把pcapy 0.10.8下载到C:\pcapy-0.10.8。
When I try to do the install, the following happens:
当我尝试安装时,会发生以下情况:
C:\pcapy-0.10.8>c:\Python27\python.exe setup.py install
running install
running build
running build_ext
building 'pcapy' extension
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\Bin\amd64\cl.exe /c /nolog o /Ox /MD /W3 /GS- /DNDEBUG -DWIN32=1 -Ic:\devel\oss\wpdpack\Include -Ic:\Python27\include -Ic:\Python27\PC /Tppcapdumper.cc /Fobuild\temp.win-amd64-2.7\Release \pcapdumper.obj
pcapdumper.cc
pcapdumper.cc(12) : fatal error C1083: Cannot open include file: 'pcap.h': No such file or directory
error: command 'cl.exe' failed with exit status 2
I don't know where it's looking for pcap.h. I can confirm that there is no file by that name in the pcapy-0.10.8 directory.
我不知道它在哪里找pcaph。我可以确认在pcapy-0.10.8目录中没有这个名称的文件。
What am I missing? I just now installed WinPcap -- do I need a reboot or something? Thanks!
我缺少什么?我刚刚安装了WinPcap——需要重启吗?谢谢!
Edited to add... here is the output from my WinPcap install log:
编辑添加…这是我的WinPcap安装日志的输出:
WinPcap 4.1.0.2980 Installation LOG
-----------------------------------------------------
Debug Information
Operating system detected on registry: 7 - AMD64
True operating system (kernel.dll): 7 - AMD64
npptools.dll present on the system: false
netnm.inf present on the system: false
nmnt.sys present on the system: false
End of log
-----------------------------------------------------
Do the false
s there mean that WinPcap did not get installed properly? I was hoping to find pcap.h under my WinPcap directory, but it's not there. I do see where I could add additional include file directories in the setup.py if needed, but I can't find pcap.h anywhere on my machine. Where am I supposed to be getting that from?
这是否意味着WinPcap没有正确安装?我希望找到pcap。在我的WinPcap目录下,但它不在那里。我确实看到了在设置中我可以添加额外的文件目录。如果需要的话,py,但是我找不到pcap。在我机器上的任何地方。我应该从哪里得到这些?
4 个解决方案
#1
5
C:\pcapy-0.10.8>c:\Python27\python.exe setup.py install
From the text on the CoreLabs site for pcapy, that suggests that you downloaded the source rather than the Win32 binary. Unless you really need to build from source, you will probably find it a LOT easier to just install the binary.
从CoreLabs网站上的pcapy的文本中可以看出,你下载的是源代码而不是Win32二进制文件。除非您确实需要从源代码构建,否则您可能会发现安装二进制文件要容易得多。
Do the falses there mean that WinPcap did not get installed properly?
这是否意味着WinPcap没有正确安装?
No.
不。
I was hoping to find pcap.h
我希望能找到pcaph。
Then, IF you NEED to build from source, you need to install the WinPcap Developer's Pack. WinPcap is just the "run time", sufficient for programs such as Wireshark that have already been built, but not sufficient for software that uses WinPcap and that need to be compiled on your machine - and, apparently, whatever flavor of pcapy you downloaded needs to be built.
然后,如果需要从源代码构建,则需要安装WinPcap开发人员包。WinPcap只是“运行时间”,对于已经构建的Wireshark之类的程序来说已经足够了,但是对于使用WinPcap的软件来说,这还不够,而且还需要在你的机器上编译——显然,你下载的pcapy的任何口味都需要构建。
(This is similar to the way libpcap is packaged on many Linux distributions - the "libpcap" package just installs the run time, and you need to install a "libpcap-dev" package, or something such as that, to get the header files.)
(这类似于libpcap在许多Linux发行版中打包的方式——“libpcap”包只安装运行时,您需要安装一个“libpcap-dev”包,或诸如此类的东西,以获取头文件。)
But if the Windows binary works for you, don't bother with the WinPcap developer's pack.
但是如果Windows二进制文件对你有用,那就别去管WinPcap开发人员的包了。
#2
3
Building on Josh P's answer (which I used to get most of the way there just now):
根据Josh P的回答(我以前大部分时间都是这样做的):
- download the WinPcap Developer's pack
- 下载WinPcap开发人员的包。
- extract the zip file (e.g.
c:\users\foo\Downloads\WpdPack_4_1_2
) - 解压压缩文件(如:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \下载\ \ \ \ \
- build using the
--global-option
to pass in the header and linker locations - 使用- globaloption在页眉和链接器位置传递。
When specifying the library folder for the linker, on Windows 7, I needed to specify the x64 version of the lib, not the (default) x32 version of the lib:
在Windows 7上为链接器指定库文件夹时,我需要指定lib的x64版本,而不是(默认的)x32版本的lib:
pip install pcapy --global-option="build_ext"
--global-option="-Ic:\users\foo\Downloads\WpdPack_4_1_2\WpdPack\include"
--global-option="-Lc:\users\foo\Downloads\WpdPack_4_1_2\WpdPack\lib\x64"
I was getting the following link errors when using the ...\lib
(x32) version of the file:
在使用…时,我得到以下链接错误。\lib (x32)版本的文件:
Creating library build\temp.win-amd64-2.7\Release\pcapy.lib and object build\temp.win-amd64-2.7\Release\pcapy.exp
pcapdumper.obj : error LNK2019: unresolved external symbol pcap_dump_close
referenced in function "void __cdecl pcap_dealloc(struct pcapdumper *)"
(?pcap_dealloc@@YAXPEAUpcapdumper@@@Z)
#3
2
As Guy Harris explained, it's generally easier to download install a binary. If you do build from source:
正如盖伊·哈里斯(Guy Harris)所解释的,下载安装二进制文件通常比较容易。如果您从源代码构建:
- Download the WinPcap Developer's Pack.
- 下载WinPcap开发人员的包。
-
Use pip's
--global-option
. setup.py is different, but I think pip is preferred over setup.py anyway.使用脉冲的——global-option。设置。py是不同的,但是我认为pip优于设置。py。
Here's an example line (substitute in the correct paths for your system; I just referenced them right in the Downloads folder):
这里有一个示例行(用正确的路径替换系统;我只是在下载文件夹里引用了它们):
pip install ./pcapy-src-dir --global-option=build_ext --global-option="-LC:\path\to\WpdPack_4_1_2\WpdPack\Lib" --global-option="-IC:\path\to\WpdPack_4_1_2\WpdPack\Include
See also this answer.
也看到这个答案。
#4
0
In the pcapy-0.11.1 the setup.py
is smarter, even smarter that what they described on their wiki page: https://github.com/CoreSecurity/pcapy/wiki/Compiling-Pcapy-on-Windows-Guide
在pcapy-0.11.1中设置。py更聪明,甚至更聪明,他们在自己的wiki页面上所描述的是:https://github.com/coresecurity/pcapy/wiki/汇编- windows - guide。
The investigation demonstrated that's enough to set environment variable WPDPACK_BASE
, so in Windows' case it may look like:
调查显示,这足以设置环境变量WPDPACK_BASE,所以在Windows的情况下,它可能是:
set WPDPACK_BASE=C:\Software\WpdPack
It's even able to detect if you need 32 or 64 bit version of these libraries.
它甚至能够检测到是否需要这些库的32或64位版本。
Previous answers didn't help me solve the problem, but helped me digging. So they may be bit outdated.
以前的答案并不能帮我解决问题,但帮助我挖掘。所以他们可能有点过时。
#1
5
C:\pcapy-0.10.8>c:\Python27\python.exe setup.py install
From the text on the CoreLabs site for pcapy, that suggests that you downloaded the source rather than the Win32 binary. Unless you really need to build from source, you will probably find it a LOT easier to just install the binary.
从CoreLabs网站上的pcapy的文本中可以看出,你下载的是源代码而不是Win32二进制文件。除非您确实需要从源代码构建,否则您可能会发现安装二进制文件要容易得多。
Do the falses there mean that WinPcap did not get installed properly?
这是否意味着WinPcap没有正确安装?
No.
不。
I was hoping to find pcap.h
我希望能找到pcaph。
Then, IF you NEED to build from source, you need to install the WinPcap Developer's Pack. WinPcap is just the "run time", sufficient for programs such as Wireshark that have already been built, but not sufficient for software that uses WinPcap and that need to be compiled on your machine - and, apparently, whatever flavor of pcapy you downloaded needs to be built.
然后,如果需要从源代码构建,则需要安装WinPcap开发人员包。WinPcap只是“运行时间”,对于已经构建的Wireshark之类的程序来说已经足够了,但是对于使用WinPcap的软件来说,这还不够,而且还需要在你的机器上编译——显然,你下载的pcapy的任何口味都需要构建。
(This is similar to the way libpcap is packaged on many Linux distributions - the "libpcap" package just installs the run time, and you need to install a "libpcap-dev" package, or something such as that, to get the header files.)
(这类似于libpcap在许多Linux发行版中打包的方式——“libpcap”包只安装运行时,您需要安装一个“libpcap-dev”包,或诸如此类的东西,以获取头文件。)
But if the Windows binary works for you, don't bother with the WinPcap developer's pack.
但是如果Windows二进制文件对你有用,那就别去管WinPcap开发人员的包了。
#2
3
Building on Josh P's answer (which I used to get most of the way there just now):
根据Josh P的回答(我以前大部分时间都是这样做的):
- download the WinPcap Developer's pack
- 下载WinPcap开发人员的包。
- extract the zip file (e.g.
c:\users\foo\Downloads\WpdPack_4_1_2
) - 解压压缩文件(如:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \下载\ \ \ \ \
- build using the
--global-option
to pass in the header and linker locations - 使用- globaloption在页眉和链接器位置传递。
When specifying the library folder for the linker, on Windows 7, I needed to specify the x64 version of the lib, not the (default) x32 version of the lib:
在Windows 7上为链接器指定库文件夹时,我需要指定lib的x64版本,而不是(默认的)x32版本的lib:
pip install pcapy --global-option="build_ext"
--global-option="-Ic:\users\foo\Downloads\WpdPack_4_1_2\WpdPack\include"
--global-option="-Lc:\users\foo\Downloads\WpdPack_4_1_2\WpdPack\lib\x64"
I was getting the following link errors when using the ...\lib
(x32) version of the file:
在使用…时,我得到以下链接错误。\lib (x32)版本的文件:
Creating library build\temp.win-amd64-2.7\Release\pcapy.lib and object build\temp.win-amd64-2.7\Release\pcapy.exp
pcapdumper.obj : error LNK2019: unresolved external symbol pcap_dump_close
referenced in function "void __cdecl pcap_dealloc(struct pcapdumper *)"
(?pcap_dealloc@@YAXPEAUpcapdumper@@@Z)
#3
2
As Guy Harris explained, it's generally easier to download install a binary. If you do build from source:
正如盖伊·哈里斯(Guy Harris)所解释的,下载安装二进制文件通常比较容易。如果您从源代码构建:
- Download the WinPcap Developer's Pack.
- 下载WinPcap开发人员的包。
-
Use pip's
--global-option
. setup.py is different, but I think pip is preferred over setup.py anyway.使用脉冲的——global-option。设置。py是不同的,但是我认为pip优于设置。py。
Here's an example line (substitute in the correct paths for your system; I just referenced them right in the Downloads folder):
这里有一个示例行(用正确的路径替换系统;我只是在下载文件夹里引用了它们):
pip install ./pcapy-src-dir --global-option=build_ext --global-option="-LC:\path\to\WpdPack_4_1_2\WpdPack\Lib" --global-option="-IC:\path\to\WpdPack_4_1_2\WpdPack\Include
See also this answer.
也看到这个答案。
#4
0
In the pcapy-0.11.1 the setup.py
is smarter, even smarter that what they described on their wiki page: https://github.com/CoreSecurity/pcapy/wiki/Compiling-Pcapy-on-Windows-Guide
在pcapy-0.11.1中设置。py更聪明,甚至更聪明,他们在自己的wiki页面上所描述的是:https://github.com/coresecurity/pcapy/wiki/汇编- windows - guide。
The investigation demonstrated that's enough to set environment variable WPDPACK_BASE
, so in Windows' case it may look like:
调查显示,这足以设置环境变量WPDPACK_BASE,所以在Windows的情况下,它可能是:
set WPDPACK_BASE=C:\Software\WpdPack
It's even able to detect if you need 32 or 64 bit version of these libraries.
它甚至能够检测到是否需要这些库的32或64位版本。
Previous answers didn't help me solve the problem, but helped me digging. So they may be bit outdated.
以前的答案并不能帮我解决问题,但帮助我挖掘。所以他们可能有点过时。