LoginSignup
12
5

More than 3 years have passed since last update.

pythonエラー対処[bs4.FeatureNotFound]

Last updated at Posted at 2019-09-16

はじめに

Pythonでクローリングを試そうと思い、BeautifulSoupを使うことにしたところ、bs4に関するエラーが発生しました。

今後のためも兼ねて備忘録的に載せます、よかったら役立ててください。

エラー内容

BeautifulSoupを含むPythonスクリプトを実行する際に以下のエラーが発生しました。

error
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?

解決方法

1.依存パッケージをインストール

以下のコマンドを実行することでエラーが解消される。

solution
pip3 install lxml

2.依存パッケージをインストール

コメントからのアドバイスで、Python標準のパーサを使用すると良いとのこと。使用例は以下。

use_html.parser
BeautifulSoup(markup, "html.parser")

参考

12
5
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
5