Python no module named serial / no module named requests

我的未来我决定 提交于 2019-12-11 08:17:37

问题


This is the second time today this has happened..

I tried to import requests earlier and I got an Import Error: no module named requests

Same thing for serial

I googled the crap out of this and nothing I've found works. Any ideas as to what's going on? I'm trying to use pyserial to take input from an arduino


回答1:


pip install requests
pip install pyserial

should do it (unless you don't have pip installed)




回答2:


are you looking for urllib.requests? if you are using python 2.7 when you ask for requests you import urllib and you don't actually use request, but its methods are available to the urllib handle, so for instance:

urllib.urlopen("http://google.com")

will work in python 2.7.x, where

urllib.request.urlopen("http://google.com")

will work in python3.x.x



来源:https://stackoverflow.com/questions/22295895/python-no-module-named-serial-no-module-named-requests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!