PDFから表を抽出するPythonライブラリ「Camelot」のインストールについて解説しています。
「Camelot(https://camelot-py.readthedocs.io/en/master/)」は、PDFから表を抽出することのできるPythonのライブラリです。
■Python
今回のPythonのバージョンは、「3.8.5」を使用しています。(Windows10)(pythonランチャーでの確認)
■Camelotをインストールする
Camelotをインストールを行いますが、今回はpipを経由してインストールを行うので、まずWindowsのコマンドプロンプトを起動します。
pip install "camelot-py[base]"
起動後、上記のコマンドを入力し、Enterキーを押します。
なお、今回は、pythonランチャーを使用しており、Python Version 3.8.5にインストールを行うために、バージョンの切り替えを行います。
py -3.8 -m pip install "camelot-py[base]"
切り替えるために、上記のコマンドを入力し、Enterキーを押します。
Defaulting to user installation because normal site-packages is not writeable Collecting camelot-py[base] Downloading camelot_py-0.10.1-py3-none-any.whl (40 kB) ---------------------------------------- 41.0/41.0 kB 654.3 kB/s eta 0:00:00 Collecting PyPDF2>=1.26.0 Downloading PyPDF2-2.10.3-py3-none-any.whl (214 kB) ---------------------------------------- 214.3/214.3 kB 1.6 MB/s eta 0:00:00 Collecting tabulate>=0.8.9 Using cached tabulate-0.8.10-py3-none-any.whl (29 kB) Requirement already satisfied: pandas>=0.23.4 in c:\users\user_\appdata\roaming\python\python38\site-packages (from camelot-py[base]) (1.4.3) Collecting chardet>=3.0.4 Downloading chardet-5.0.0-py3-none-any.whl (193 kB) ---------------------------------------- 193.6/193.6 kB 2.0 MB/s eta 0:00:00 Collecting click>=6.7 Using cached click-8.1.3-py3-none-any.whl (96 kB) Collecting openpyxl>=2.5.8 Downloading openpyxl-3.0.10-py2.py3-none-any.whl (242 kB) ---------------------------------------- 242.1/242.1 kB 1.2 MB/s eta 0:00:00 Collecting pdfminer.six>=20200726 Using cached pdfminer.six-20220524-py3-none-any.whl (5.6 MB) Requirement already satisfied: numpy>=1.13.3 in c:\users\user_\appdata\roaming\python\python38\site-packages (from camelot-py[base]) (1.23.2) Collecting ghostscript>=0.7 Downloading ghostscript-0.7-py2.py3-none-any.whl (25 kB) Collecting opencv-python>=3.4.2.17 Downloading opencv_python-4.6.0.66-cp36-abi3-win_amd64.whl (35.6 MB) ---------------------------------------- 35.6/35.6 MB 4.4 MB/s eta 0:00:00 Collecting pdftopng>=0.2.3 Downloading pdftopng-0.2.3-cp38-cp38-win_amd64.whl (1.5 MB) ---------------------------------------- 1.5/1.5 MB 4.6 MB/s eta 0:00:00 Collecting colorama Using cached colorama-0.4.5-py2.py3-none-any.whl (16 kB) Requirement already satisfied: setuptools>=38.6.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from ghostscript>=0.7->camelot-py[base]) (62.3.3) Collecting et-xmlfile Using cached et_xmlfile-1.1.0-py3-none-any.whl (4.7 kB) Requirement already satisfied: python-dateutil>=2.8.1 in c:\users\user_\appdata\roaming\python\python38\site-packages (from pandas>=0.23.4->camelot-py[base]) (2.8.2) Requirement already satisfied: pytz>=2020.1 in c:\users\user_\appdata\roaming\python\python38\site-packages (from pandas>=0.23.4->camelot-py[base]) (2022.2.1) Collecting cryptography>=36.0.0 Using cached cryptography-37.0.4-cp36-abi3-win_amd64.whl (2.4 MB) Collecting charset-normalizer>=2.0.0 Downloading charset_normalizer-2.1.1-py3-none-any.whl (39 kB) Requirement already satisfied: typing-extensions in c:\users\user_\appdata\roaming\python\python38\site-packages (from PyPDF2>=1.26.0->camelot-py[base]) (4.3.0) Collecting cffi>=1.12 Using cached cffi-1.15.1-cp38-cp38-win_amd64.whl (178 kB) Requirement already satisfied: six>=1.5 in c:\users\user_\appdata\roaming\python\python38\site-packages (from python-dateutil>=2.8.1->pandas>=0.23.4->camelot-py[base]) (1.16.0) Collecting pycparser Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB) Installing collected packages: tabulate, PyPDF2, pycparser, opencv-python, ghostscript, et-xmlfile, colorama, charset-normalizer, chardet, openpyxl, click, cffi, pdftopng, cryptography, pdfminer.six, camelot-py Successfully installed PyPDF2-2.10.3 camelot-py-0.10.1 cffi-1.15.1 chardet-5.0.0 charset-normalizer-2.1.1 click-8.1.3 colorama-0.4.5 cryptography-37.0.4 et-xmlfile-1.1.0 ghostscript-0.7 opencv-python-4.6.0.66 openpyxl-3.0.10 pdfminer.six-20220524 pdftopng-0.2.3 pycparser-2.21 tabulate-0.8.10
Enterキーを押すと、インストールが開始され、上記のように「Successfully installed」と表示されます。これが表示されると、camelot-pyのインストールが正常に完了となります。
なお、今回はcamelot-pyのバージョン0.10.1をインストールしました。
コメント