【Python】ファイルシステムイベントを監視するための「watchdog」のインストール

スポンサーリンク

ファイルシステムイベントを監視するためのPythonライブラリ「watchdog」のインストールについて解説しています。

「watchdog(https://github.com/gorakhargosh/watchdog)」は、ファイルシステムの変更を監視し、ファイルの作成、削除、変更などのイベントをキャッチするためのライブラリです。

■Python

今回のPythonのバージョンは、「3.8.5」を使用しています。(Windows11)

■watchdogをインストールする

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

pip install watchdog

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

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

py -3.8 -m pip install watchdog

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

Defaulting to user installation because normal site-packages is not writeable
Collecting watchdog
Downloading watchdog-3.0.0-py3-none-win_amd64.whl (82 kB)
|████████████████████████████████| 82 kB 1.5 MB/s
Installing collected packages: watchdog
WARNING: The script watchmedo.exe is installed in 'C:\Users\user_\AppData\Roaming\Python\Python38\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 watchdog-3.0.0
WARNING: You are using pip version 21.1.1; however, version 23.1.2 is available.
You should consider upgrading via the 'C:\Program Files\Python38\python.exe -m pip install --upgrade pip' command.

Enterキーを押すと、インストールが開始され、上記のように「Successfully installed」と表示されます。これが表示されれば、watchdogが正常にインストールされたことになりますが、「WARNING」と表示されました。「WARNING」はエラーではなく警告で、インストールは行われているので、今回は一旦無視しています。

なお、今回はwatchdogのバージョン3.0.0をインストールしました。

コメント

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