How to solve ModuleNotFoundError: No module named 'BeautifulSoup'?

yts61 Source

i am learning Python, and have installed python3 through home-brew. and then i successfully installed BeautifulSoup, and Requests through Pip3.

the codes in terminal

Lorentzs-MacBook-Pro:~ Lorentz$ pip3 install beautifulsoup4
Collecting beautifulsoup4
  Using cached     https://files.pythonhosted.org/packages/9e/d4/10f46e5cfac773e22707237bfcd51bbffeaf0a576b0a847ec7ab15bd7ace/beautifulsoup4-4.6.0-py3-none-any.whl
Installing collected packages: beautifulsoup4
Successfully installed beautifulsoup4-4.6.0
Lorentzs-MacBook-Pro:~ Lorentz$ pip3 install requests
Requirement already satisfied: requests in     /usr/local/lib/python3.6/site-packages (2.19.1)
Requirement already satisfied: idna<2.8,>=2.5 in /usr/local/lib/python3.6/site-packages (from requests) (2.7)
Requirement already satisfied: urllib3<1.24,>=1.21.1 in /usr/local/lib/python3.6/site-packages (from requests) (1.23)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/site-packages (from requests) (2018.4.16)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.6/site-packages (from requests) (3.0.4)
Lorentzs-MacBook-Pro:~ Lorentz$ python3 /Users/Lorentz/Desktop/py4e/Practice/test.py
Traceback (most recent call last):
  File "/Users/Lorentz/Desktop/py4e/Practice/test.py", line 3, in <module>
    import BeautifulSoup
ModuleNotFoundError: No module named 'BeautifulSoup'

when i run my python file , it shows

import BeautifulSoup
ModuleNotFoundError: No module named 'BeautifulSoup'

how can i solve this? i have already tried to uninstall python3, and reinstall it through home-brew, and reinstall Pip3, Requests, and beautifulSoup again, but it still shows me the error. Please assist to solve this.

pythonbeautifulsoup

Answers

answered 3 months ago Taohidul Islam #1

Have you tried this?

from bs4 import BeautifulSoup

comments powered by Disqus