我按照官方 scapy 文档中的建议通过 MacPorts 安装了 scapy:http ://www.secdev.org/projects/scapy/doc/installation.html#mac-os-x
当我从命令行运行 scapy 时,它工作得很好。
但是现在我似乎无法将 scapy 导入 Python 解释器或 python 脚本中,这是错误。
Python 2.7.3 (default, Jan 31 2013, 22:54:33)
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import scapy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named scapy
我也尝试过使用 Python2.5,也不起作用。
Python 2.5.6 (r256:88840, Aug 5 2011, 03:29:42)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import scapy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named scapy
我认为它与路径有关,但我不知道在 Mac 上的哪里编辑这些,尤其是我从 MacPorts 安装了 scapy。