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,870 points
5,565 views

1 answer to this question.

0 votes

Run with Python 3 from the command line:

python3 script.py
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
11,049 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
3,128 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
14,425 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 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,851 views
0 votes
0 answers
+4 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,810 points
1,424 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
392 views