![]() |
Cannot import BeautifulSoup4 as bs4 and BeautifulSoup4 not in same directory - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: Cannot import BeautifulSoup4 as bs4 and BeautifulSoup4 not in same directory (/thread-19593.html) |
Cannot import BeautifulSoup4 as bs4 and BeautifulSoup4 not in same directory - B5473829 - Jul-05-2019 I have installed BeautifulSoup using pip command and installed successfully. When I attempted to import it in Python; the following error appears. >>> from bs4 import BeautifulSoup4 Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: cannot import name 'BeautifulSoup4' from 'bs4' (C:\Python37-64\lib\site-packages\bs4\__init__.py) >>> I checked my filemanager and see that bs4 and beautifulsoup4 are in separate directories. C:\Python37-64\Lib\site-packages\bs4 C:\Python37-64\Lib\site-packages\beautifulsoup4-4.7.1.dist-info I saw in another forum to combine both in the project folder I will be working on. But I haven't created any project yet. Just wanted to get Python set up correctly first. Thanks RE: Cannot import BeautifulSoup4 as bs4 and BeautifulSoup4 not in same directory - snippsat - Jul-05-2019 It's from bs4 import BeautifulSoup Take a look at Web-Scraping part-1, part2 |