我成功使用了简单的脚本
$ cat com/speedtestcli
#!/bin/bash
#
# check internet speed
#
#https://askubuntu.com/questions/104755/how-to-check-internet-speed-via-terminal
curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python3
我也尝试了包装版本
speedtest-cli --secure
在这两种情况下,脚本都会失败并出现以下终端输出:
$ com/speedtestcli
Retrieving speedtest.net configuration...
Testing from YYYYYYY (x.x.x.x)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
ERROR: Unable to connect to servers to test latency.
或者
$ speedtest-cli --secure
Retrieving speedtest.net configuration...
Testing from YYYYYYY (x.x.x.x)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
ERROR: Unable to connect to servers to test latency.
考虑到我使用的是 Ububtu 20.04 和 python 3.8.10。速度测试失败的原因是什么?有没有我可以从命令行运行的替代程序?