V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
chuhades
V2EX  ›  Python

mac 安装 scapy 报错

  •  
  •   chuhades ·
    Q2h1Cg · 2015-01-23 21:54:54 +08:00 · 4973 次点击
    这是一个创建于 3374 天前的主题,其中的信息可能已经有所发展或是发生改变。

    用brew 安装scapy,执行 from scapy.all import * 会报错:

    chu@sh3ll-me:~/Downloads/BHP-Code/Chapter4 » python mail_sniffer.py 
    Traceback (most recent call last):
      File "mail_sniffer.py", line 2, in <module>
        from scapy.all import *
      File "/usr/local/lib/python2.7/site-packages/scapy/all.py", line 25, in <module>
        from route import *
      File "/usr/local/lib/python2.7/site-packages/scapy/route.py", line 162, in <module>
        conf.route=Route()
      File "/usr/local/lib/python2.7/site-packages/scapy/route.py", line 22, in __init__
        self.resync()
      File "/usr/local/lib/python2.7/site-packages/scapy/route.py", line 31, in resync
        self.routes = read_routes()
      File "/usr/local/lib/python2.7/site-packages/scapy/arch/unix.py", line 86, in read_routes
        ifaddr = scapy.arch.get_if_addr(netif)
      File "/usr/local/lib/python2.7/site-packages/scapy/arch/__init__.py", line 36, in get_if_addr
        return socket.inet_ntoa(get_if_raw_addr(iff))
      File "/usr/local/lib/python2.7/site-packages/scapy/arch/pcapdnet.py", line 187, in get_if_raw_addr
        i = dnet.intf()
    AttributeError: 'module' object has no attribute 'intf'
    

    有人遇到过么,求解决方案.

    4 条回复    2015-01-25 20:36:01 +08:00
    wilsoncao
        1
    wilsoncao  
       2015-01-23 23:40:32 +08:00
    最近装了一个 但没有遇到这种情况,我是按照一个教程来做的但不是直接用brew这样粗暴的方法。。。感觉依赖包还是挺多的。。参考一下这个: http://scrapy-chs.readthedocs.org/zh_CN/latest/intro/install.html#intro-install
    casparchen
        2
    casparchen  
       2015-01-24 04:13:21 +08:00   ❤️ 1
    @wilsoncao 楼主说的不是scrapy
    wilsoncao
        3
    wilsoncao  
       2015-01-24 08:27:29 +08:00
    @casparchen 我错了。。。
    chuhades
        4
    chuhades  
    OP
       2015-01-25 20:36:01 +08:00
    自己来结个贴,仔细看报错,是说dnet module没有intf 方法,发现自己的机子上装了两个dnet,一个是pip装的,还有一个dnet.so,删除了pip安装的那个就可以了。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   908 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 21:03 · PVG 05:03 · LAX 14:03 · JFK 17:03
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.