Python Requests module - Import Error No module named requests

564    Asked by CameronOliver in Python , Asked on Jul 12, 2021

I'm trying to use the requests module, but I'm having trouble importing it. I'm running Python 3.4.2 (which I checked is officially supported) on Windows 7. I've tried installing it the following ways, each time with no luck: Using pip install requests. Downloading the zip ball and installing using setup.py install Downloading the source code and manually copying the folder to Python34/Lib/site-packages. In all those cases, I can see that the requests library is in the site-packages folder. If I run import requests from the python interpreter, it works fine. This works:

$ python
>>> import requests
>>> requests.get("http://127.0.0.1")

It always results in this error:

Traceback (most recent call last):
  File "E:test.py", line 1, in
    import requests
ImportError: No module named requests  

How do I fix an Importerror No module named Request python?

 

Answered by Carl Paige

You are getting this error because you have not installed the request module. Because requests are not a built-in module (it does not come with the default python installation), so you will have to install it in order to run it properly Run with Python 3 from the command line: python3 script.py



Your Answer

Interviews

Parent Categories