VPS 移行中に、以下の エラーが発生しました。
ModuleNotFoundError: No module named 'BeautifulSoup'
上記は、BeautifulSoup が インストールされていないために発生しています。
対象のプログラムで使用していた BeautifulSoup の Version は、BeatifulSoup3 です。
BeautifulSoup3 を pip でインストールを試みたところ、以下のエラーが発生しました。
-
BeatifulSoup3 のインストール
python3.6 -m pip install beautifulsoup
-
エラー
Collecting beautifulsoup Downloading BeautifulSoup-3.2.1.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-build-5hb2sild/beautifulsoup/setup.py", line 22 print "Unit tests have failed!" ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(int "Unit tests have failed!")? ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-5hb2sild/beautifulsoup/
setup.py 内の print function でエラーとなっています。
BeautifulSoup3 は、Python 3 では インストールができなそうなので、BeautifulSoup4 にライブラリを読み替えることにしました。
-
変更前
from BeautifulSoup import BeautifulSoup
-
変更後
from bs4 import BeautifulSoup
-
BeautifulSoup4 のインストール
python3.6 -m pip install beautifulsoup4
以上です。
コメント