Python | 問題解決 | “WARNING: The scripts pip.exe, pip3.12.exe and pip3.exe are installed in ‘C:\Users\xxx\Python\Python312\Scripts’ which is not on PATH”

2023年12月25日

pipenvを利用してDjangoの環境構築していた.pipenvにてDjangoをインストールする際,エラーが発生した.その問題解決をしている途中で以下コードを実行した.

python.exe -m pip install --upgrade pip --user

上記コードを実行したところ,以下警告が発生したため,その解決方法をこちらの記事にて記す.

"WARNING: The scripts pip.exe, pip3.12.exe and pip3.exe are installed in 'C:\Users\shiro\AppData\Roaming\Python\Python312\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 pip-23.3.2"

実施環境

各バージョンの確認方法はこちら

OS: Windows11
Python 3.12.0
pipenv version 2022.11.30

問題解決方法

警告の確認

以下警告の概要は以下になる.

“pip.exe, pip3.12.exe, pip3.exeがPATHにはないディレクトリにインストールされているので,当該ディレクトリをPATHに加えることを検討してください."

"WARNING: The scripts pip.exe, pip3.12.exe and pip3.exe are installed in 'C:\Users\shiro\AppData\Roaming\Python\Python312\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 pip-23.3.2"

以上より,以下ディレクトリをPATHに加える方法を以下に記す.

C:\Users\shiro\AppData\Roaming\Python\Python312\Scripts

特定のディレクトリをPATHに加える方法

以下ウィンドウズマークを右クリックする.

以下メニューが開くので,"システム"をクリックする.

以下画面に遷移するので,"システムの詳細設定"をクリックする.

以下メニューバーが開くので,"詳細設定"タブを選択し,"環境変数"をクリックする.

以下環境変数メニューが開くので,"システム環境変数"の"Path"を選択し,"編集"ボタンをクリックする.

以下編集画面に遷移するので,"新規"ボタンをクリックする.

以下のように,ディレクトリを貼り付けし,"OK"をクリックする.

以上