Wish to learn webscrapping. I tried to import requests module in python but it throws an error as below.
>>> import requests
Traceback (most recent call last):
File "", line 1, in
import requests
ImportError: No module named 'requests'
>>>
I am using windows 7. Python 3.5.1.[64 bit]. If requests module is to be installed, then please direct me how? pip install requests throws an error as below.
>>> pip install requests
SyntaxError: invalid syntax
>>>
解决方案You have to install the requests module. pip is the easiest option, but that is not a Python command. pip is an executable which you can find in \Scripts. So to install requests, open Windows's Command Prompt (so not Python) and run:
C:\Python35\Scripts\pip install requests
(assuming C:\Python35 is the Python installation directory)
Yes, this is an old question, when I followed the commands above (THANK YOU) it helped me to realize that I was still missing something (lxml). Therefore, you will need to install both packages; "lxml" and "requests" using "pip install lxml" and "pip install requests".
1. First Find the directory where Python installed.
Let's say "C:\Program Files (x86)\Python36_64\Scripts\"
2. Make sure you open CMD "Run as Admin", and run the following commands:
3. Change the directory to Python folder:
cd "C:\Program Files (x86)\Python36_64\Scripts\"
"pip install lxml"
"pip install requests"
Hope this helps who else stumbled on this, just like me!