无法在python中安装scapy模块

时间:2016-08-02 12:13:07

标签: python django python-2.7 python-3.x module

我使用的是python版本2.7和Pycharm IDE,我通过pycharm UI安装了scapy模块(文件---默认设置 - 添加了scapy)

from scapy.all import DNS


Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/apple/Library/Python/2.7/lib/python/site-packages/scapy/all.py", line 16, in <module>
    from arch import *
  File "/Users/apple/Library/Python/2.7/lib/python/site-packages/scapy/arch/__init__.py", line 76, in <module>
    from bsd import *
  File "/Users/apple/Library/Python/2.7/lib/python/site-packages/scapy/arch/bsd.py", line 12, in <module>
    from unix import *
  File "/Users/apple/Library/Python/2.7/lib/python/site-packages/scapy/arch/unix.py", line 20, in <module>
    from pcapdnet import *
  File "/Users/apple/Library/Python/2.7/lib/python/site-packages/scapy/arch/pcapdnet.py", line 173, in <module>
    import dnet
ImportError: No module named dnet

当我在上面的语句中运行它显示上面的错误时,我成功安装了scapy模块......

1 个答案:

答案 0 :(得分:0)

您必须安装libdnet

$ wget http://libdnet.googlecode.com/files/libdnet-1.12.tgz
$ tar xfz libdnet-1.12.tgz
$ ./configure
$ make
$ sudo make install
$ cd python
$ python2.5 setup.py install

对于64位....

$ CFLAGS='-arch i386 -arch x86_64' ./configure
$ archargs='-arch i386 -arch x86_64' make