Issue
I am trying to learn web-scraping using Python and installed Requests using
pip3 install requests
and checked again using the same command. I got the following output:
Requirement already satisfied: requests in /usr/local/lib/python3.6/dist-packages
But when I tried to execute the following code:
from bs4 import BeautifulSoup
import requests
with open('/home/aca/Documents/Python files/test.html') as html_file:
soup = BeautifulSoup(html_file, 'lxml')
print(soup.prettify())
in Atom v 1.26.1, I received the following error message:
Traceback (most recent call last):
File "/home/aca/Documents/Python files/experiment.py", line 2, in <module>
import requests
ImportError: No module named requests
[Finished in 0.167s]
I confirmed the installation of Requests in IDLE by importing it using the Python shell and task completed without ImportError.
I am stuck at this point. Is this an issue of an older version Atom? If yes please suggest a lightweight ide for lubuntu 18.04.
Solution
Try checking your Python versions. It's quite possible that you have Requests installed in one interpreter, while Atom uses another.
Run your script directly in the command line.
Answered By - Michail Highkhan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.