美文网首页
使用 speedtest_cli 测试宽带速度

使用 speedtest_cli 测试宽带速度

作者: l蓝色梦幻 | 来源:发表于2018-10-22 16:47 被阅读44次

speedtest_cli 是一个使用 speedtest.net 来测试因特网带宽的命令行界面。通过这种方式,你也可以在没有浏览器或者图形化界面的服务器上做带宽测试。

  1. 安装

    • pip 安装

      pip install speedtest_cli
      
    • easy_install 安装

      easy_install speedtest_cli
      
    • Github 安装

      git clone https://github.com/sivel/speedtest-cli.git
      python speedtest-cli/setup.py install
      

      或者

      pip install git+https://github.com/sivel/speedtest-cli.git
      
  2. 使用

    • 基本用法. 这样你会在终端中活得带宽报告

      # speedtest-cli 
      Retrieving speedtest.net configuration...
      Testing from China Telecom JILIN (123.172.16.158)...
      Retrieving speedtest.net server list...
      Selecting best server based on ping...
      Hosted by China Unicom Heilongjiang Branch (Harbin) [232.20 km]: 92.151 ms
      Testing download speed................................................................................
      Download: 8.37 Mbit/s
      Testing upload speed................................................................................................
      Upload: 84.01 Mbit/s
      
    • 分享你的宽带速度,那么在命令后面加上 --share 即可

      # speedtest-cli --share
      Retrieving speedtest.net configuration...
      Testing from China Telecom JILIN (123.172.16.158)...
      Retrieving speedtest.net server list...
      Selecting best server based on ping...
      Hosted by China Unicom Heilongjiang Branch (Harbin) [232.20 km]: 88.509 ms
      Testing download speed................................................................................
      Download: 6.41 Mbit/s
      Testing upload speed................................................................................................
      Upload: 41.37 Mbit/s
      Share results: http://www.speedtest.net/result/7736883263.png
      

      生成的图像是:

      image
    • 列出所有speedtest.net服务器

      # speedtest-cli --list
      Retrieving speedtest.net configuration...
      9484) China Unicom (Changchun, China) [0.00 km]
      16375) China Mobile,Jilin (Changchun, China) [0.00 km]
      5460) China Unicom Heilongjiang Branch (Harbin, China) [232.20 km]
      17437) China Mobile Heilongjiang branch (Harbin, China) [234.29 km]
      ....
      
    • 使用特定的服务器

      speedtest-cli --server 9484
      Retrieving speedtest.net configuration...
      Testing from China Telecom JILIN (123.172.16.158)...
      Retrieving speedtest.net server list...
      Retrieving information for the selected server...
      Hosted by China Unicom (Changchun) [0.00 km]: 96.466 ms
      Testing download speed................................................................................
      Download: 9.27 Mbit/s
      Testing upload speed................................................................................................
      Upload: 68.49 Mbit/s
      

错误集合

  1. pip command not found

    #  yum -y install python-setuptools
    #  easy_install pip
    

相关文章

网友评论

      本文标题:使用 speedtest_cli 测试宽带速度

      本文链接:https://www.haomeiwen.com/subject/okbgzftx.html