1. 安裝Speedtest
speedtest是一個用Python編寫的輕量級Linux命令行工具,在Python2.4至3.4版本下均可運行。它基於Speedtest.net的基礎架構來測量網絡的上/下行速率。
方法1:yum安裝
raw.githubusercontent.com
是github的用戶資源服務器,部署在aws的服務器上,雲服務器訪問一般沒什麼問題,但本地機器可能出現443的錯誤,可以選擇第二種安裝方法。
wget https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod a+x speedtest.py
mv speedtest.py /usr/local/bin/speedtest
方法2:pip安裝
更方便,但有兩個前提要求
- 系統需要有python
- python的bin已添加到環境變量
pip isntall speedtest-cli
2. 使用speedtest測網速
$ speedtest
3. 排錯
3.1 pip安裝出現urlopen error
安裝urlopen庫後正常