LoginSignup
1
2

More than 1 year has passed since last update.

WindowsでPython venv仮想環境作成

Posted at

Windowsの方がPythonの仮想環境を作る場合、はじめに警告文が出たりしてどうするのか聞かれることがあったので、手順を残しておきます。

まず PowerShell を開き、下記内容を実行してください。

💡 仮想環境構築が初めての場合 初めて Windows で仮想環境を作成しようとすると PSSecurityException が発生することがあります。その場合は次のコマンドを実行してください。

Set-Executionpolicy RemoteSigned -Scope CurrentUser

仮想環境の作成は次のコマンドを入力します。うまくいくと venv というフォルダが作成されます。

python -m venv venv

仮想環境のアクティベート(有効化)は次のコマンドを実行します。

venv\Scripts\activate

うまくいくと PowerShell 内の表記に (venv)と記載されます。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2