问题
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