PythonWebスクレイピングフレームワーク「grab」のインストール

スポンサーリンク

PythonWebスクレイピングフレームワーク「grab」のインストールについて解説しています。

「grab(https://github.com/lorien/grab)」は、ネットワークリクエストを実行し、Webサイトをスクレイピングし、スクレイピングされたコンテンツを処理することができます。2022年6月現在は、pycurlバックエンドは削除され、唯一のネットワークトランスポートはurllib3となっている。

■Python

今回のPythonのバージョンは、「3.6.8」を使用しています。(Windows10)(pythonランチャーでの確認)

■grabをインストールする

grabをインストールを行いますが、今回はpipを経由してインストールを行うので、まずWindowsのコマンドプロンプトを起動します。

pip install grab

起動後、上記のコマンドを入力し、Enterキーを押します。

なお、今回は、pythonランチャーを使用しており、Python Version 3.6.8にインストールを行うために、バージョンの切り替えを行います。

py -3.6 -m pip install grab

切り替えるために、上記のコマンドを入力し、Enterキーを押します。

Defaulting to user installation because normal site-packages is not writeable
Collecting grab
Downloading grab-0.6.41.tar.gz (1.1 MB)
|████████████████████████████████| 1.1 MB 595 kB/s
Collecting weblib>=0.1.28
Downloading weblib-0.1.30.tar.gz (30 kB)
Requirement already satisfied: six in c:\users\user_\appdata\roaming\python\python36\site-packages (from grab) (1.16.0)
Collecting user_agent
Downloading user_agent-0.1.10.tar.gz (20 kB)
Collecting selection
Downloading selection-0.0.14.tar.gz (4.5 kB)
Collecting defusedxml
Using cached defusedxml-0.7.1-py2.py3-none-any.whl (25 kB)
Collecting pytils
Downloading pytils-0.4.1.tar.gz (99 kB)
|████████████████████████████████| 99 kB 1.5 MB/s
Installing build dependencies … done
Getting requirements to build wheel … done
Preparing wheel metadata … done
Downloading pytils-0.4.0.tar.gz (91 kB)
|████████████████████████████████| 91 kB 2.0 MB/s
Installing build dependencies … done
Getting requirements to build wheel … done
Preparing wheel metadata … done
Collecting isort<6.0.0,>=5.10.1
Downloading isort-5.10.1-py3-none-any.whl (103 kB)
|████████████████████████████████| 103 kB 3.3 MB/s
Collecting pytils
Downloading pytils-0.3.tar.gz (89 kB)
|████████████████████████████████| 89 kB 1.8 MB/s
Building wheels for collected packages: grab, weblib, pytils, selection, user-agent
Building wheel for grab (setup.py) … done
Created wheel for grab: filename=grab-0.6.41-py3-none-any.whl size=84710 sha256=7d7907e0f4d16a07e545b083f8b48599271f3cace7655989d092e766422e4bb7
Stored in directory: c:\users\user_\appdata\local\pip\cache\wheels\6d\c4\3a\9cad8b43304e7b4729e334e964f7ecb9549225ca3bcb275c78
Building wheel for weblib (setup.py) … done
Created wheel for weblib: filename=weblib-0.1.30-py3-none-any.whl size=40171 sha256=71742e425cdde867af9bed3f30f408998c7c74556170c97383da1ad58892c161
Stored in directory: c:\users\user_\appdata\local\pip\cache\wheels\df\73\eb\202f3ec5ef3d6da5b671e54fe0128fe9a2da10153f93b518a3
Building wheel for pytils (setup.py) … done
Created wheel for pytils: filename=pytils-0.3-py3-none-any.whl size=40378 sha256=6818f520309a4ab7448aa9b8c5918c858ec3b89f52fff478e8ac4a6189277b95
Stored in directory: c:\users\user_\appdata\local\pip\cache\wheels\af\40\b8\85d20ee26272520271c32f1324af2aeb382431d3115bacb2a1
Building wheel for selection (setup.py) … done
Created wheel for selection: filename=selection-0.0.14-py3-none-any.whl size=5371 sha256=2ac240281eb966fe78da892f5b738822123f1ac8357641518edb38180c8055c9
Stored in directory: c:\users\user_\appdata\local\pip\cache\wheels\fa\1d\c3\23a1dfacd1713885a73313d6ecb42d51b2003e618e5ac9ac07
Building wheel for user-agent (setup.py) … done
Created wheel for user-agent: filename=user_agent-0.1.10-py3-none-any.whl size=18982 sha256=d42fc84e3de514750b222ebe6e7e6e6248fc3e46622fbfeeae08df568596d07d
Stored in directory: c:\users\user_\appdata\local\pip\cache\wheels\78\4e\f0\92c4562766afd3d71b43ec0afb262177fd0c4cc26140170c77
Successfully built grab weblib pytils selection user-agent
Installing collected packages: user-agent, pytils, weblib, selection, defusedxml, grab
WARNING: The script ua.exe is installed in ‘C:\Users\user_\AppData\Roaming\Python\Python36\Scripts’ which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use –no-warn-script-location.
Successfully installed defusedxml-0.7.1 grab-0.6.41 pytils-0.3 selection-0.0.14 user-agent-0.1.10 weblib-0.1.30
WARNING: You are using pip version 21.1.2; however, version 21.3.1 is available.
You should consider upgrading via the ‘C:\Program Files\Python36\python.exe -m pip install –upgrade pip’ command.

Enterキーを押すと、インストールが開始され、上記のように「Successfully installed」と表示されます。これが表示されれば、grabが正常にインストールされたことになります。

なお、今回はgrabのバージョン0.6.41をインストールしました。インストールの際に「WARNING」が出力されていますが、警告でありエラーではないので、今回は一旦無視しています。

コメント

タイトルとURLをコピーしました