Win7 64位 安装pcapy 包时报错:
error: command ‘"C:\Users\Administrator\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe"‘ failed with exit status 11
20
安装过程参考如下后,依然报错:
http://blog.csdn.net/qidi_huang/article/details/51692506
查看setup.py文件,发现依赖于环境变量:WPDPACK_BASE,
1 if sys.platform == ‘win32‘: 2 if os.environ.get(‘WPDPACK_BASE‘): 3 wpdpack = os.environ[‘WPDPACK_BASE‘] 4 include_dirs.append(os.path.join(wpdpack, ‘Include‘)) 5 if sys.maxsize > 2**32: # x64 Python interpreter 6 print "64" 7 library_dirs.append(os.path.join(wpdpack, ‘Lib‘, ‘x64‘)) 8 else: # x86 Python interpreter 9 library_dirs.append(os.path.join(wpdpack, ‘Lib‘)) 10 else: 11 # WinPcap include files 12 include_dirs.append(r‘c:\wpdpack\Include‘) 13 # WinPcap library files 14 library_dirs.append(r‘c:\wpdpack\Lib‘) 15 libraries = [‘wpcap‘, ‘packet‘, ‘ws2_32‘] 16 else: 17 libraries = [‘pcap‘, ‘stdc++‘]
解决方案如下:
将 pcapy模块放置的目录,加入到环境变量,我的如下:
>>> os.environ.get(‘WPDPACK_BASE‘)
‘C:\\WpdPack‘
>>>
重新运行 python setup.py install ,OK了。