Python 2.7 我得到属性错误:';模块';对象没有属性';enableTrace';在运行python代码时

Python 2.7 我得到属性错误:';模块';对象没有属性';enableTrace';在运行python代码时,python-2.7,websocket,python-import,python-module,Python 2.7,Websocket,Python Import,Python Module,我使用的是Python2.7,我已经安装了模块websocket client 0.40.0,但是我得到了如上所述的属性错误 这是我的代码,我正在尝试通过websocket将我的PC连接到微控制器板 import websocket import nltk from nltk.tokenize import PunktSentenceTokenizer import sys import urllib import urlparse from urllib2 import HTTPError f

我使用的是Python2.7,我已经安装了模块websocket client 0.40.0,但是我得到了如上所述的属性错误

这是我的代码,我正在尝试通过websocket将我的PC连接到微控制器板

import websocket
import nltk
from nltk.tokenize import PunktSentenceTokenizer
import sys
import urllib
import urlparse
from urllib2 import HTTPError
from urllib2 import URLError
from getch import getch, pause
import numpy as np
websocket.enableTrace(True)
ws = websocket.create_connection("ws://169.254.7.144:1234") 
当我运行这个程序时,我得到了错误

文件“on_laptop.py”,第35行,在

websocket.enableTrace(True)

AttributeError:“module”对象没有属性“enableTrace”

您可能安装了
websocket
包(它没有
enableTrace
方法),而不是
websocket客户端

pip安装websocket客户端
应该可以解决您的问题