Z
Z
zlodiak2020-01-03 19:41:26
linux
zlodiak, 2020-01-03 19:41:26

How to import beautyfulSoup?

Please tell me how to import BeautyfulSoup in python3.8. I use pipenv if that's important to know.
According to the documentation , I installed bs4 in the OS:
apt-get install python3-bs4
Then installed bs4 itself like this:
pipenv install bs4
as a result, my dependencies look like this:

[email protected] ~/.MINT18/code/python/lor_parser $ pipenv graph
bs4==0.0.1
  - beautifulsoup4 [required: Any, installed: 4.8.2]
    - soupsieve [required: >=1.2, installed: 1.9.5]
requests==2.22.0
  - certifi [required: >=2017.4.17, installed: 2019.11.28]
  - chardet [required: >=3.0.2,<3.1.0, installed: 3.0.4]
  - idna [required: >=2.5,<2.9, installed: 2.8]
  - urllib3 [required: >=1.21.1,<1.26,!=1.25.1,!=1.25.0, installed: 1.25.7]

but after running the following script:
from urllib import urlopen
from bs4 import BeautifulSoup

I am getting the following error message:
[email protected] ~/.MINT18/code/python/lor_parser $ python index.py
Traceback (most recent call last):
  File "index.py", line 2, in <module>
    from bs4 import BeautifulSoup
ImportError: No module named bs4

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dr. Bacon, 2020-01-03
@zlodiak

1. Why install in the OS, and then separately in a virtual environment, where is it written?
2. when there was a call to python index.py, before that the environment was activated through pipenv shell, if not, but you need to use pipenv run index.py
3 no need to get used to the bad, use lxml right away

A
Alex F, 2020-01-03
@delvin-fil

apt-get install python3-bs4
Then installed bs4 itself like this:
pipenv install bs4

Yes, all this is not necessary.
Simple:
That's all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question