How to install beautifulsoup into python3, when default dir is python2.7? How to install beautifulsoup into python3, when default dir is python2.7? python-3.x python-3.x

How to install beautifulsoup into python3, when default dir is python2.7?


I think pip3 will satisfy your needs, use the below command on the terminal:

pip3 install beautifulsoup4

See doc


Run as root:

apt-get install python3-bs4#orpip3 install beautifulsoup4

Afterwards import it like this:

import bs4


If you’re using a recent version of Debian or Ubuntu Linux, you can install Beautiful Soup with the system package manager:

$ apt-get install python-bs4 (for Python 2)$ apt-get install python3-bs4 (for Python 3)

Afer install import the library

from bs4 import BeautifulSoup