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)
Asked
Active
Viewed 64 times
-2
-
What have you tried to solve the problem? Your question lacks focus. There are tons of similar types already available. Flagging the question to be closed. – mnm Oct 03 '21 at 04:25
-
Does this answer your question? [ImportError: No module named requests](https://stackoverflow.com/questions/17309288/importerror-no-module-named-requests) – ridvanaltun Oct 03 '21 at 21:31
2 Answers
0
Have you already installed beautifulsoup4 module?? if not please firstly install the module..
pip install beautifulsoup4

Tariq Ahmed
- 471
- 3
- 14
-
-
@AnsumanaKorleh ok try to import correctly now ```from bs4 import BeautifulSoup as bs``` – Tariq Ahmed Oct 03 '21 at 05:11
0
- 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

Mahmoud Aly
- 578
- 3
- 10