![](/img/trans.png)
[英]AttributeError: module 'websocket' has no attribute 'WebSocketApp' pip
[英]AttributeError: module 'websocket' has no attribute 'WebSocketApp'
相关代码片段:
pip 安装 websocket-client
进口 websocket
def on_open(ws): blahblah
def on_close(ws): blahblahblah
def on_message(ws,message): blahblahblah
ws = websocket.WebSocketApp(SOCKET,on_open=on_open,on_close=on_close,on_message=on_message)
ws.run_forever()
我收到错误 AttributeError: module 'websocket' has no attribute 'WebSocketApp' on j upyter notebook这很奇怪,因为我在Google Colab上运行完全相同的代码,但我没有收到任何错误。
我什么都试过了:! 我尝试按照此处的建议进行操作: AttributeError: module 'websocket' has no attribute 'WebSocketApp' pip
我也试过这个: AttributeError: 'module' object has no attribute 'WebSocketApp'
我试图在我的文件中搞砸,但无论我做什么,我都会继续收到这个错误......
我的 python 版本是 3.8.3 btw。 有没有人知道这里有什么问题?
尝试从打开的终端或命令提示符运行,我在尝试使用 python 脚本 package 在 ATOM 中运行代码时遇到了同样的问题。 我认为与安装多个版本的 Python 有关。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.