简体   繁体   English

ImportError:没有名为twisted.websocket的模块

[英]ImportError: No module named twisted.websocket

I have tried one of example web-socket client codes in autobahn web site. 我已经尝试过在高速公路网站中使用示例网络套接字客户端代码之一。 But it gives me the error 但这给了我错误

ImportError: No module named twisted.websocket

even though I have already installed autobahn. 即使我已经安装了高速公路。 When I try to install "twisted" explicitly it tells me that "twisted" is already installed. 当我尝试显式安装“ twisted”时,它告诉我“ twisted”已安装。 I'm working on a Ubuntu machine. 我正在Ubuntu机器上工作。

You are trying to import a module twisted.websocket which doesn't exist (and never has). 您正在尝试导入一个不存在(也从来没有)的twisted.websocket模块。 The example has the module autobahn.twisted.websocket , which is part of autobahn, not twisted. 该示例包含模块autobahn.twisted.websocket ,该模块是autobahn.twisted.websocket一部分,未扭曲。

The docs seem to be outdated/inaccurate. 该文档似乎已过时/不正确。 Try: 尝试:

from autobahn.websocket import WebSocketServerProtocol

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM