Autobahn cannot import name error

耗尽温柔 提交于 2019-12-10 15:08:59

问题


I have installed twisted and Autobahn websocket by using

pip install twisted
pip install autobahn

But when I import any of the factories from Autobahn, I get the cannot import name error.

    >>> from twisted.internet import reactor
    >>> from autobahn.websocket import WebSocketClientFactory
    Traceback (most recent call last):
      File "<console>", line 1, in <module>
    ImportError: cannot import name WebSocketClientFactory

Is there anything I am missing? Here's the pip freeze

Twisted==13.2.0
Twisted-Core==12.3.0
Twisted-Names==12.3.0
Twisted-Web==12.3.0
autobahn==0.7.4
websocket==0.2.1
websocket-client==0.13.0

回答1:


It looks as thoough WebSocketClientFactory is in twisted sub-module:

from autobahn.twisted.websocket import WebSocketClientFactory




回答2:


Seems like installing python3 with pip and then installing autobahn solves this issue

Command below is for ubuntu users :

sudo apt-get install python3-pip
sudo pip3 install autobahn


来源:https://stackoverflow.com/questions/21381454/autobahn-cannot-import-name-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!