When I use the code "from bs4 import beautifulsoup as bs" I get the following ImportError: ImportError with a directory: cannot import name 'BeautifulSoup4' from 'bs4' (C:\Users.........anaconda3\lib\site-packages\bs4_init_.py)
CodePudding user response:
Have you already installed beautifulsoup4 module?? if not please firstly install the module..
pip install beautifulsoup4
CodePudding user response:
- Make sure that module is already installed.
>>> import bs4
If the module is not installed, you will seethis error ModuleNotFoundError
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'bs4'
>>>
- Install the module with pip
pip install beautifulsoup4
- Import the module correctly..
from bs4 import BeautifulSoup as bs