Beautiful Soup 4 not working with Python 3.4.0

I am using Ubuntu 14.04 64 bit Operating System .

I installed Beautiful Soup 4 using this command :

sudo apt-get install python-bs4

With Python 2.7.6 , I had no difficulty importing the bs4 module. But when I used Python 3.4.0 it showed me this error.

>>>import bs4
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'bs4'

I also tried to install it using pip.

sudo pip install beautifulsoup4

But again it didn't worked with Python 3.4.0.

Right now I have uninstalled pip and also uninstalled Beautiful Soup 4

sudo apt-get remove python-bs4
sudo apt-get remove python-pip

What should I do next to properly install Beautiful Soup 4 for both Python 2.7.6 and Python 3.4.0 ??


Solution 1:

In all currently supported versions of Ubuntu open the terminal and run:

sudo apt-get install python3-bs4

python3-bs4 is an error-tolerant HTML parser for Python 3. You can see from this that there are two different packages: python-bs4 (for Python 2.x) and python3-bs4 (for Python 3.x), and to prevent you from getting confused there are also two different Integrated Development Environments for Python: IDLE and IDLE 3 to run them in.