0
我發現華爲移動路由器有趣的文章: https://blog.hqcodeshop.fi/archives/259-Huawei-E5186-AJAX-API.html 在第二條評論中,有人命名rvl提供了他的腳本,以便通過API自動重啓,如果需要的話。Python - 華爲重啓腳本
我試圖自己修復縮進。這是一個結果http://pastebin.com/KqF5RsS0 我不確定它是否正確。甚至不知道我應該使用哪個版本的Python來運行它。
[email protected] ~> /usr/bin/python2 router-reboot-script.py
Traceback (most recent call last):
File "router-reboot-script.py", line 6, in <module>
import requests
ImportError: No module named requests
或
[[email protected] ~]$ python -m router-reboot-script.py
/usr/bin/python: Error while finding spec for 'router-reboot-script.py' (AttributeError: module 'router-reboot-script' has no attribute '__path__')
我沒有Python的技能。有人能幫我弄清楚如何運行它嗎?
編輯
[[email protected] ~]$ sudo pip install requests
Requirement already satisfied (use --upgrade to upgrade): requests in /usr/lib/python3.5/site-packages
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[[email protected] ~]$ sudo pip install --upgrade pip
Collecting pip
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 686kB/s
Installing collected packages: pip
Found existing installation: pip 8.1.2
Uninstalling pip-8.1.2:
Successfully uninstalled pip-8.1.2
Successfully installed pip-9.0.1
[[email protected] ~]$ sudo pip install requests
Requirement already satisfied: requests in /usr/lib/python3.5/site-packages
[[email protected] ~]$ python -m router-reboot-script.py
/usr/bin/python: Error while finding spec for 'router-reboot-script.py' (AttributeError: module 'router-reboot-script' has no attribute '__path__')
[[email protected] ~]$ python router-reboot-script.py
我應該使用哪個版本的Python我應該使用的,什麼樣的參數(如-m)?
從第一個錯誤,好像你就錯過了請求模塊。你嘗試過'pip安裝請求'然後再運行一次嗎? –
用您的問題的答案編輯。 – sabbath