没有名为“websocket"的模块 [英] No module named 'websocket'

查看:56
本文介绍了没有名为“websocket"的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Python 的新手,我正在尝试输入以下代码:

I'm a fairly new to Python and I am trying to enter the following code:

from websocket import create_connection as cc
import json, time

我想以实时提要类型的方式查看 BTC 和 LTC 股票,但我一直收到此错误:

I want to look at BTC and LTC stocks in a live feed type-fashion but I keep getting this error:

ModuleNotFoundError: 没有名为websocket"的模块

ModuleNotFoundError: No module named 'websocket'

我环顾四周,似乎一个常见的解决方案是:

I've been looking around and it seems that a common solution is:

pip install websocket

那只是没有与我联系.大多数网站都说安装这个并且只有上面的代码,但我不知道在哪里安装它或如何处理它.

that just didn't connect with me. Most sites say install this and just have the above code but I have no idea where to install it or what to do with it.

推荐答案

首先,如果你没有 pip,你需要安装它.在终端或 cmd 中输入 pip 以查看它是否已安装.或者,首先通过下载 get-pip.py 并执行它来安装它.

First, you need to install pip if you don't have it. Type pip in your terminal or cmd to see if it is installed. Or else, install it first by downloading get-pip.py and executing it.

然后你执行pip install websocket,它会为你安装模块.

Then you do pip install websocket, which will install the module for you.

这篇关于没有名为“websocket"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆