在 python 3.5 上安装 pyshark

install pyshark on python 3.5

我已经在 mac os x (el capitan) 上安装了 python 3.5。我想在 python 中导入 pyshark 模块,但出现错误。 我安装了 pyshark 要求,例如 (logbook, lxml, trollies, py) 但我无法导入 pyshark 模块。

pip3 list >>
syncio (3.4.3)
futures (3.0.3)
Logbook (0.12.3)
lxml (3.5.0)
pip (7.1.2)
py (1.4.30)
pyshark (0.3.6)
setuptools (18.2)
trollius (2.0)

导入pyshark模块错误:

>>> import pyshark
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyshark/__init__.py", line 1, in <module>
    from pyshark.capture.live_capture import LiveCapture
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyshark/capture/live_capture.py", line 1, in <module>
    from pyshark.capture.capture import Capture
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyshark/capture/capture.py", line 6, in <module>
    import trollius as asyncio
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/trollius/__init__.py", line 21, in <module>
    from .base_events import *
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/trollius/base_events.py", line 39, in <module>
    from . import coroutines
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/trollius/coroutines.py", line 15, in <module>
    from . import futures
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/trollius/futures.py", line 116, in <module>
    class Future(object):
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/trollius/futures.py", line 426, in Future
    __await__ = __iter__ # make compatible with 'await' expression
NameError: name '__iter__' is not defined

同样导入trollies模块报错:

>>> import trollius
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/trollius/__init__.py", line 21, in <module>
    from .base_events import *
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/trollius/base_events.py", line 39, in <module>
    from . import coroutines
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/trollius/coroutines.py", line 15, in <module>
    from . import futures
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/trollius/futures.py", line 116, in <module>
    class Future(object):
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/trollius/futures.py", line 426, in Future
    __await__ = __iter__ # make compatible with 'await' expression
NameError: name '__iter__' is not defined

谁能帮帮我?我不知道是什么问题。

这被报告为 https://github.com/haypo/trollius/issues/4

中的错误

在问题解决之前,您可以通过从 ludios 安装 an unofficial development version 暂时解决它:

pip install -U git+https://github.com/ludios/trollius@f757a29815c2c9f5c3a691135ff758649fe84098#egg=trollius

请记住,这只是一个临时的非官方解决方案。所以点击问题页面上的 "subscribe" 按钮:https://github.com/haypo/trollius/issues/4 订阅通知。待官方解决问题后,使用官方解决方案。