Python Requests module - Import Error No module named requests

0 votes

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")
<Response [200]>

It always results in this error:

Traceback (most recent call last):
  File "E:\test.py", line 1, in <module>
    import requests
ImportError: No module named requests   
Sep 11, 2020 in Python by anonymous
• 65,890 points
20,462 views

1 answer to this question.

0 votes

Run with Python 3 from the command line:

python3 script.py


Hope this helps!!

If you need to know more about Python, join Python online course today.

Thanks!

answered Sep 11, 2020 by Malik Brahimi

Related Questions In Python

0 votes
2 answers

Python error " import requests ImportError: No module named requests"

Hello, Open Cmd or Powershell as Admin. type pip ...READ MORE

answered Nov 28, 2020 in Python by Rohan
• 200 points
17,415 views
0 votes
1 answer
0 votes
1 answer

Python error "ImportError: No module named pygame.locals"

You need to download and install the ...READ MORE

answered Jun 18, 2019 in Python by Greg
6,899 views
0 votes
1 answer
0 votes
2 answers

Python error "ImportError: No module named 'tkinter'"

sudo apt-get install python3-tk Then, >> import tkinter # ...READ MORE

answered Nov 9, 2019 in Python by Icetutor
• 160 points
24,665 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,395 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
3,999 views
0 votes
1 answer

ImportError: No module named requests

To install requests module on Debian/Ubuntu for Python2: $ sudo ...READ MORE

answered Sep 11, 2020 in Python by Deming
1,412 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP