0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Windows&Python環境構築(venv)

Posted at

Windows & Python venv環境構築

以下でPythonをダウンロード

  • 二つのチェックボックスにチェックを入れてダウンロード

PowerShell

インストール確認

python -V

##
Python x.x.x

venv環境構築

cd <your venv project dir>
py -x.x -m venv <your env name>
# 後述↓
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
.\<your env name>\Scripts\activate

##
(your env name) PS C:\Users\

セキュリティエラー回避

Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process

これを実行せずにアクティベートしようとすると

.\Scripts\activate : このシステムではスクリプトの実行が無効になっているため、ファイル C:\Users\... を読み込むことができません。詳細については、「about_Execution_Policies」(https://go.microsoft.com/fwlink/?L
inkID=135170) を参照してください。
発生場所 行:1 文字:1
+ .\Scripts\activate
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : セキュリティ エラー: (: ) []、PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

と言われる.

VScodeでの実行時

  • 以下の設定を追加するとアクティベートできるようになる
setting.json
{
        "terminal.integrated.env.windows": {
        "PSExecutionPolicyPreference": "RemoteSigned"
    }
}
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?