AttributeError: module 'websocket' has no attribute 'enableTrace'

使用tushare,test.py

import tushare

print(tushare.__version__)

报错

Traceback (most recent call last):
File "test.py", line 1, in <module>
import tushare
File "D:\Python37\lib\site-packages\tushare\__init__.py", line 82, in <module>
from tushare.pro.data_pro import (pro_api, pro_bar, subs)
File "D:\Python37\lib\site-packages\tushare\pro\data_pro.py", line 14, in <module>
from tushare.subs import Subs
File "D:\Python37\lib\site-packages\tushare\subs\__init__.py", line 18, in <module>
websocket.enableTrace(False)
AttributeError: module 'websocket' has no attribute 'enableTrace'

安装websocket-client

pip install websocket-client

提示已经安装了,但是还报错,先将以前的移除

pip uninstall websocket-client

再安装websocket-client后

>python test.py
1.2.60

问题解决

 

posted @ 2020-10-20 09:23  慕尘  阅读(2813)  评论(0编辑  收藏  举报