우분투에서 Python 2.7에 beautifulsoup를 어떻게 설치합니까?

우분투에서 Python 2.7에 beautifulsoup를 어떻게 설치합니까?

제가 작성 중인 채팅 봇에 대한 종속성이 누락된 것 같습니다. Python 2.7용 beautifulsoup4를 설치하려고 합니다.

문제의 함수를 사용하려고 하면 프로그램에서 이 오류가 반환됩니다.

/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py:794:
InsecureRequestWarning: Unverified HTTPS request is being made. 
Adding certificate verification is strongly advised. See:
https://urllib3.readthedocs.org/en/latest/security.html InsecureRequestWarning)
Unhandled exception in thread started by <function run at 0x7f24085aaaa0>

Traceback (most recent call last):    
  File "core/main.py", line 77, in run    
    out = func(input.inp, **kw)    
  File "plugins/comic.py", line 88, in comic    
    return val['data']['link']    
KeyError: 'link'

검색해본 결과 누락된 종속성과 관련이 있을 수 있는 것 같습니다(이 경우에는 beautifulsoup).

답변1

현재 지원되는 모든 Ubuntu 버전에서 터미널을 열고 다음을 실행합니다.

sudo apt-get install python-bs4

Beautiful Soup(python-bs4)는 Python 2.x용 오류 허용 HTML 파서입니다. python-bs4(Python 2.x용)와 python3-bs4(Python 3.x용)라는 두 가지 패키지가 있으며, 혼동을 방지하기 위해 Python용 두 가지 통합 개발 환경(IDLE 및 IDLE 3)도 있습니다. 그들을 실행합니다.

관련 정보