webmaster-kazu.com

テクノロジー・データ分析・実践ログ・その他

Python辞書のための軽量のスキーマ及びデータ検証ツール「Cerberus」のインストール

カテゴリ: Python【初歩から現場実務的なもの】

Python辞書のための軽量のスキーマ及びデータ検証ツール「Cerberus」のインストールについて解説しています。

「Cerberus(https://docs.python-cerberus.org/en/stable/)」スキーマ及びデータ検証ツールで、シンプルで軽量なデータ検証機能を提供し、簡単に拡張できるように設計されています。

■Python

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

■Cerberusをインストールする

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

pip install Cerberus

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

なお、今回は、pythonランチャーを使用しており、Python Version 3.8.5にインストールを行うために、pipを使う場合にはコマンドでの切り替えを行います。

py -3.8 -m pip install Cerberus

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

Defaulting to user installation because normal site-packages is not writeable

Collecting Cerberus

Downloading Cerberus-1.3.4.tar.gz (63 kB)

|████████████████████████████████| 63 kB 489 kB/s

Installing build dependencies ... done

Getting requirements to build wheel ... done

Preparing metadata (pyproject.toml) ... done

Requirement already satisfied: setuptools in c:\users\user_\appdata\roaming\python\python38\site-packages (from Cerberus) (59.6.0)

Building wheels for collected packages: Cerberus

Building wheel for Cerberus (pyproject.toml) ... done

Created wheel for Cerberus: filename=Cerberus-1.3.4-py3-none-any.whl size=58196 sha256=e36328f0d57f677f3e5f445c4e593219a5337e0ef600ae0bf09cdfc417955843

Stored in directory: c:\users\user_\appdata\local\pip\cache\wheels\92\1e\40\307520b5eb38ceae17d32d7d7920e3e5eee6f4cd78cfd75ac7

Successfully built Cerberus

Installing collected packages: Cerberus

Successfully installed Cerberus-1.3.4

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

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