Autobahn无法导入名称

2024-06-26 14:53:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我用

pip install twisted
pip install autobahn

但当我从高速公路上导入任何工厂时,都会出现“无法导入名称”错误。

    >>> 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

我有什么遗漏吗? 这是pip冻结

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

Tags: installpipfromimport名称工厂错误twisted
2条回答

好像用pip安装python3然后安装autobahn就解决了这个问题

以下命令适用于ubuntu用户:

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

看起来好像WebSocketClientFactorytwisted sub-module中:

from autobahn.twisted.websocket import WebSocketClientFactory

相关问题 更多 >