pip を使用して Checkov をインストールまたは更新できませんでした。 エラー: Microsoft Windows に Visual Studio Code Checkov 拡張機能をインストール中に。

pip を使用して Checkov をインストールまたは更新できませんでした。 エラー: Microsoft Windows に Visual Studio Code Checkov 拡張機能をインストール中に。

17450
Created On 04/19/22 18:48 PM - Last Modified 07/14/25 23:07 PM


Objective


Microsoft Windows に Visual Studio Code Checkov 拡張機能をインストールしているときに、次のエラーが発生する可能性があります。
-Failed to install or update Checkov using pip3
-Failed to install or update Checkov using pip
-Command failed: python3 --version\n'python3' is not recognized as an internal or external command
-Error: Command failed: python --version\n'python' is not recognized as an internal or external command

エラー出力の例:
Checkov logs
[info]: Starting Checkov Extension. {"extensionVersion":"1.0.72","vscodeVersion":"1.65.2"}
[info]: Trying to install Checkov using Docker. 
[debug]: Testing docker installation with command: docker pull bridgecrew/checkov:latest 
[error]: Failed to install or update Checkov using Docker. Error: {"error":{"killed":false,"code":1,"signal":null,
"cmd":"docker pull bridgecrew/checkov:latest","message":"Command failed: docker pull bridgecrew/checkov:latest\n'docker' is not recognized as an internal or 
external command,\r\noperable program or batch file.\r\n","stack":
"Error: Command failed: docker pull bridgecrew/checkov:latest\n'docker' is not recognized as an internal or external command,\r\noperable program or 
batch file.\r\n\n\tat ChildProcess.exithandler 
(child_process.js:317:12)\n\tat ChildProcess.emit (events.js:315:20)\n\tat maybeClose (internal/child_process.js:1048:16)\n\tat Socket.<anonymous>
 (internal/child_process.js:439:11)\n\tat Socket.emit (events.js:315:20)\n\tat
 Pipe.<anonymous> (net.js:673:12)"}}
[info]: Trying to install Checkov using pip3. 
[debug]: Getting python version with command: python3 --version 
[error]: Failed to install or update Checkov using pip3. Error: {"error":
{"killed":false,"code":1,"signal":null,"cmd":"python3 --
version","message":"Command failed: python3 --version\n'python3' is not recognized 
as an internal or external command,\r\noperable program or batch 
file.\r\n","stack":"Error: Command failed: python3 --version\n'python3' is not 
recognized as an internal or external command,\r\noperable program or batch 
file.\r\n\n\tat ChildProcess.exithandler (child_process.js:317:12)\n\tat 
ChildProcess.emit (events.js:315:20)\n\tat maybeClose 
(internal/child_process.js:1048:16)\n\tat Socket.<anonymous> 
(internal/child_process.js:439:11)\n\tat Socket.emit (events.js:315:20)\n\tat 
Pipe.<anonymous> (net.js:673:12)"}}
[info]: Retrying using `python` and `pip` 
[debug]: Getting python version with command: python --version 
[error]: Failed to install or update Checkov using pip. Error: {"error":
{"killed":false,"code":1,"signal":null,"cmd":"python --version","message":"Command
 failed: python --version\n'python' is not recognized as an internal or external 
command,\r\noperable program or batch file.\r\n","stack":"Error: Command failed: 
python --version\n'python' is not recognized as an internal or external 
command,\r\noperable program or batch file.\r\n\n\tat ChildProcess.exithandler 
(child_process.js:317:12)\n\tat ChildProcess.emit (events.js:315:20)\n\tat 
maybeClose (internal/child_process.js:1048:16)\n\tat Socket.<anonymous> 
(internal/child_process.js:439:11)\n\tat Socket.emit (events.js:315:20)\n\tat 
Pipe.<anonymous> (net.js:673:12)"}}
[info]: Trying to install Checkov using pipenv. 
[debug]: Installation dir: c:\Users\USERNAME\AppData\Roaming\Code\User\globalStorage\bridgecrew.checkov\check
ov-installation 
[debug]: Getting python version with command: pipenv run python --version 
[error]: Failed to install or update Checkov using pipenv. Error: {"error":{"killed":false,"code":1,"signal":null,"cmd":"pipenv run python --
version","message":"Command failed: pipenv run python --version\n'pipenv' is not 
recognized as an internal or external command,\r\noperable program or batch 
file.\r\n","stack":"Error: Command failed: pipenv run python --version\n'pipenv' 
is not recognized as an internal or external command,\r\noperable program or batch 
file.\r\n\n\tat ChildProcess.exithandler (child_process.js:317:12)\n\tat 
ChildProcess.emit (events.js:315:20)\n\tat maybeClose 
(internal/child_process.js:1048:16)\n\tat Socket.<anonymous> 
(internal/child_process.js:439:11)\n\tat Socket.emit (events.js:315:20)\n\tat 
Pipe.<anonymous> (net.js:673:12)"}}
[warn]: All installation / update methods failed; attempting to fall back to a 
global checkov installation 
[error]: Could not find a global `checkov` executable either 
[error]: Error occurred while preparing Checkov. Verify your settings, or try to 
reload vscode. {"error":{"message":"Could not install Checkov.","stack":"Error: 
Could not install Checkov.\n\tat 
c:\\Users\\USERNAME\\.vscode\\extensions\\bridgecrew.checkov-
1.0.72\\out\\checkovInstaller.js:165:11\n\tat Generator.next (<anonymous>)\n\tat 
fulfilled (c:\\Users\\USERNAME\\.vscode\\extensions\\bridgecrew.checkov-
1.0.72\\out\\checkovInstaller.js:24:58)"}}


 


Environment


  • Prisma Cloud
  • コード セキュリティ / Bridgecrew
  • マイクロソフトウィンドウズ
  • Visual Studio Code Checkov 拡張機能


Procedure


ここのpythonドキュメントから – TheMSIインストーラーは、Windows のインストールに推奨されるパスです。
https://www.python.org/downloads/release/python-3102/
Picture0001.png

Python はグローバルにインストールされます
Python はグローバルにインストールされます

Windows環境変数パスの内部では、次のように設定されています –ユーザーレベルの環境

ユーザーレベルの環境

システムレベルの環境
システム レベルの環境

また、PowerShell を介して –
パワーシェル
パワーシェル

この問題は、Windows のデフォルト シェルである Powershell で発生します。VSコード。

Python3.10MSIインストールは、デフォルトで変数内のパス (AppData\Local\Programs\Python) にインストールされます。 環境が設定されているだけでなく、ファイルパスも追加されていない限り、Powershellは環境セットをロードしないようですPATH環境変数。

Python 変数を正しく解決できるようになると、pip を使用しない限り Checkov は初期化されません。
pip を使用しない限り、Checkov はまだ初期化されません。

ユーザー変数PATH-
ユーザー変数 PATH

つまり、ここでドキュメントに従う必要がありました- https://pip.pypa.io/en/stable/installation/ pip用に設定された追加の環境。

システム変数PATH(ピップに必要)
システム変数PATH(ピップに必要)

すべてが処理されると、checkov は最終的に動作状態に戻ります
checkov は最終的に動作状態に戻ります
 
 


Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA14u0000004OAnCAM&lang=ja&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail

Choose Language