下载安装speedtest-cli
测试工具
方法一: pip3 install speedtest-cli
方法二: wget https://github.com/sivel/speedtest-cli/archive/master.zip
unzip master.zip
cd speedtest-cli-master/
chmod +x speedtest_cli.py
执行speedtest.py
进行网速测试
首先我们采用pip的方式进行安装,我们需要进入python安装文件包的路径。pip3 install speedtest-cli --upgrade
Requirement already up-to-date: speedtest-cli in /usr/local/python3/lib/python3.6/site-packages (2.0.2)
从上面我们可以找到python软件包的安装路径,然后进入此路径。cd /usr/local/python3/lib/python3.6/site-packages/
chmod +x speedtest.py
./speedtest.py --bytes
Retrieving speedtest.net configuration...
Testing from International Pioneering Park (114.114.114.114)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Beijing Telecom (Beijing) [1.69 km]: 3.782 ms
Testing download speed................................................................................
Download: 1.09 Mbyte/s
Testing upload speed................................................................................................
Upload: 1.08 Mbyte/s
命令参数
- speedtest.py --bytes以字节计算的方式来测试上下行速度
- speedtest.py --share将速度测试的结果生成一张图片的连接,便于你分享
- speedtest.py --simple只显示ping和上下行速度
- speedtest.py --list 列出speedtest.net所有的服务器距离你的物理距离,单位是千米(km)
由此我们可以测试出上传和下载的速率。