How to install beautifulsoup in python3 when dir is python2.7 by default?

I have Python 2.7 and Python 3.5 installed. When I pip install beautifulsoup4report that it is already installed in the python2.7 / site-package directory.

But how do I install it in a python3 directory?

+16
source share
4 answers

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

pip3 install beautifulsoup4

See doc

+47
source

Run as root:

apt-get install python3-bs4
#or
pip3 install beautifulsoup4

Then import it as follows:

import bs4
+7
source

bs4 :

python -m pip install bs4
+1

Debian Ubuntu Linux, Beautiful Soup :

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

After installation, import the library

from bs4 import BeautifulSoup
+1
source

Source: https://habr.com/ru/post/1622056/


All Articles