特定の日付が休日であるかどうか判断できるライブラリ「holidays」のインストールについて解説しています。
「holidays(https://github.com/dr-prodigy/python-holidays)」は国、県、州固有の祝日のセットを生成するための高速で効率的なPythonのライブラリです。
■Python
今回のPythonのバージョンは、「3.8.5」を使用しています。(Windows10)(pythonランチャーでの確認)
■holidaysをインストールする
holidaysをインストールを行いますが、今回はpipを経由してインストールを行うので、まずWindowsのコマンドプロンプトを起動します。
pip install holidays
起動後、上記のコマンドを入力し、Enterキーを押します。
なお、今回は、pythonランチャーを使用しており、Python Version 3.8.5にインストールを行うために、pipを使う場合にはコマンドでの切り替えを行います。
py -3.8 -m pip install holidays
切り替えるために、上記のコマンドを入力し、Enterキーを押します。
Defaulting to user installation because normal site-packages is not writeable Collecting holidays Downloading holidays-0.12-py3-none-any.whl (165 kB) |████████████████████████████████| 165 kB 930 kB/s Collecting convertdate>=2.3.0 Downloading convertdate-2.4.0-py3-none-any.whl (47 kB) |████████████████████████████████| 47 kB 1.3 MB/s Collecting korean-lunar-calendar Downloading korean_lunar_calendar-0.2.1-py3-none-any.whl (8.0 kB) Requirement already satisfied: python-dateutil in c:\users\user_\appdata\roaming\python\python38\site-packages (from holidays) (2.8.1) Collecting hijri-converter Downloading hijri_converter-2.2.2-py3-none-any.whl (13 kB) Collecting pymeeus<=1,>=0.3.13 Downloading PyMeeus-0.5.11.tar.gz (5.4 MB) |████████████████████████████████| 5.4 MB 3.3 MB/s Preparing metadata (setup.py) ... done Requirement already satisfied: six>=1.5 in c:\users\user_\appdata\roaming\python\python38\site-packages (from python-dateutil->holidays) (1.15.0) Building wheels for collected packages: pymeeus Building wheel for pymeeus (setup.py) ... done Created wheel for pymeeus: filename=PyMeeus-0.5.11-py3-none-any.whl size=730984 sha256=8920f555c81096965edb3c5fb34d28a1a4534918314cdaa27d21551bdae066df Stored in directory: c:\users\user_\appdata\local\pip\cache\wheels\a0b\b20ae5a6f970c8be4725353400d643c90de1c0f023a9884ee7 Successfully built pymeeus Installing collected packages: pymeeus, korean-lunar-calendar, hijri-converter, convertdate, holidays Successfully installed convertdate-2.4.0 hijri-converter-2.2.2 holidays-0.12 korean-lunar-calendar-0.2.1 pymeeus-0.5.11
Enterキーを押すと、インストールが開始され、上記のように「Successfully installed」と表示されます。これが表示されれば、holidaysが正常にインストールされたことになります。
なお、今回はholidaysのバージョン0.12をインストールしました。
コメント