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


I have both Python 2.7 and Python 3.5 installed. When I type pip install beautifulsoup4 it tells me that it is already installed in python2.7/site-package directory.

But how do I install it into the python3 dir?

Asked By: ERJAN



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

pip3 install beautifulsoup4

See doc

Answered By: Alan Francis

Run as root:

apt-get install python3-bs4
pip3 install beautifulsoup4

Afterwards import it like this:

import bs4
Answered By: Mehdi Nellen

The package is bs4 and can be installed with following command:

python -m pip install bs4
Answered By: Shvet Chakra

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
Answered By: Hossain Misho

If you are on windows, this works for Python3 as well
py -m pip install bs4

Answered By: jubot

I had some mismatch between Python version and Beautifulsoup. I was installing this project
to a linux centos8 dedicated Arma3 server. Python3 and Beautifulsoup4 seem to match.So I updated Python3, removed manually Beautifulsoup files and re-installed it with: sudo yum install python3-beautifulsoup4 (note the number 3). Works. Then pointing directories in Th3Jock3R:s script A3_SERVER_FOLDER = "" and A3_SERVER_DIR = "/home/arma3server{}".format(A3_SERVER_FOLDER) placing and running the script in same folder /home/arma3server with python3 In this folder is also located new folder called ‘modlists’ Now the lightness of mod loading blows my mind. -Bob-

Answered By: Peacebob