首页 > 解决方案 > python 'speedtest' 没有属性 'Speedtest'

问题描述

我试图通过使用“speedtest”模块在python中获得下载和上传速度,但是当我使用该模块时它给了我这个错误:

AttributeError:模块“speedtest”没有属性“Speedtest”。

我只是在声明变量,即我的代码:

import speedtest

speedtester = speedtest.Speedtest()

由于某种原因,该模块实际上没有这些功能。请告诉我我的代码有什么问题我确定从 cmd 和 pycharm 终端导入模块,但仍然遇到相同的错误。提前致谢

标签: pythonspeed-test

解决方案


我遇到过同样的问题。我正在使用 PyCharm IDE。使用安装speedtest时出现问题pip install speedtest 为了解决上述问题,您需要使用以下命令。

pip install speedtest-cli

但在此之前,请使用pip uninstall speedtest 屏幕截图卸载前一个安装


推荐阅读