JavaScriptをPythonコードに変換できるライブラリ「Js2Py」をインストール

スポンサーリンク

JavaScriptをPythonコードに変換できるライブラリ「Js2Py」のインストールについて解説しています。

Js2Pyは、pythonで書かれており、依存関係はない。Js2Pyを使用すると、ほぼすべてのJavaScriptコードを変換し実行することが可能です。

■Python

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

■Js2Pyをインストールする

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

pip install Js2Py

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

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

py -3.8 -m pip install Js2Py

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

Defaulting to user installation because normal site-packages is not writeable
Collecting Js2Py
Downloading Js2Py-0.71-py3-none-any.whl (1.0 MB)
|████████████████████████████████| 1.0 MB 939 kB/s
Collecting pyjsparser>=2.5.1
Downloading pyjsparser-2.7.1.tar.gz (24 kB)
Requirement already satisfied: six>=1.10 in c:\users\user_\appdata\roaming\python\python38\site-packages (from Js2Py) (1.15.0)
Requirement already satisfied: tzlocal>=1.2 in c:\users\user_\appdata\roaming\python\python38\site-packages (from Js2Py) (2.1)
Requirement already satisfied: pytz in c:\users\user_\appdata\roaming\python\python38\site-packages (from tzlocal>=1.2->Js2Py) (2021.1)
Building wheels for collected packages: pyjsparser
Building wheel for pyjsparser (setup.py) … done
Created wheel for pyjsparser: filename=pyjsparser-2.7.1-py3-none-any.whl size=25998 sha256=b2b2b9d0daaae1a58f3218286bd1bb1cc8f4bbd2fea87e7c8b14baa19c46690c
Stored in directory: c:\users\user_\appdata\local\pip\cache\wheels\d5\88\34\ccb5bb40eb3178a134eb293e6c363928c5bcfba0b91031db76
Successfully built pyjsparser
Installing collected packages: pyjsparser, Js2Py
Successfully installed Js2Py-0.71 pyjsparser-2.7.1

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

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

コメント

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