python – ImportError: No Module Named bs4 (BeautifulSoup)

python – ImportError: No Module Named bs4 (BeautifulSoup)

Activate the virtualenv, and then install BeautifulSoup4:

$ pip install BeautifulSoup4

When you installed bs4 with easy_install, you installed it system-wide. So your system python can import it, but not your virtualenv python.
If you do not need bs4 to be installed in your system python path, uninstall it and keep it in your virtualenv.

For more information about virtualenvs, read this

For python2.x:

sudo pip install BeautifulSoup4

For python3:

sudo apt-get install python3-bs4

python – ImportError: No Module Named bs4 (BeautifulSoup)

Just tagging onto Balthazars answer. Running

pip install BeautifulSoup4

did not work for me. Instead use

pip install beautifulsoup4

Leave a Reply

Your email address will not be published. Required fields are marked *