webmaster-kazu.com

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

【Python】開発者がChatGPTをPython プロジェクトに統合できる「chatgpt」のインストール

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

【Python】開発者がChatGPTをPython プロジェクトに統合できる「chatgpt」のインストールについて解説しています。

「chatgpt(https://github.com/labteral/chatgpt-python)」は、MLモデルをすばやくスピンアップしてクエリできるよう

■Python

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

■chatgptをインストールする

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

pip install chatgpt

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

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

py -3.8 -m pip install chatgpt

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

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

Collecting chatgpt

Downloading chatgpt-2.2212.0-py3-none-any.whl (24 kB)

Collecting tls-client

Downloading tls_client-0.1.8-py3-none-any.whl (34.9 MB)

---------------------------------------- 34.9/34.9 MB 4.7 MB/s eta 0:00:00

Collecting rich

Downloading rich-13.2.0-py3-none-any.whl (238 kB)

---------------------------------------- 238.9/238.9 kB 4.9 MB/s eta 0:00:00

Collecting pygments<3.0.0,>=2.6.0

Using cached Pygments-2.14.0-py3-none-any.whl (1.1 MB)

Collecting typing-extensions<5.0,>=4.0.0

Using cached typing_extensions-4.4.0-py3-none-any.whl (26 kB)

Collecting markdown-it-py<3.0.0,>=2.1.0

Downloading markdown_it_py-2.1.0-py3-none-any.whl (84 kB)

---------------------------------------- 84.5/84.5 kB ? eta 0:00:00

Collecting mdurl~=0.1

Downloading mdurl-0.1.2-py3-none-any.whl (10.0 kB)

Installing collected packages: tls-client, typing-extensions, pygments, mdurl, markdown-it-py, rich, chatgpt

Successfully installed chatgpt-2.2212.0 markdown-it-py-2.1.0 mdurl-0.1.2 pygments-2.14.0 rich-13.2.0 tls-client-0.1.8 typing-extensions-4.4.0

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

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