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?

Python 仮想環境アクティベート用バッチファイル

Posted at

Windowsでの開発環境において、セキュリティポリシーの変更を避けたまま、Python仮想環境の作成と有効化を効率的に行う方法を紹介です。

  1. 仮想環境の作成
    最新の依存関係でvenv環境を作成するには、以下のコマンドを実行します:

    python -m venv --upgrade-deps <環境名>
    

  2. 仮想環境の自動有効化
    作成した仮想環境のディレクトリ直下に以下の内容でactivate.batを配置します:

    activate.bat
    @echo off
    powershell -NoExit -ExecutionPolicy RemoteSigned -Command "Scripts\activate"
    

このバッチファイルを実行することで、PowerShellのセキュリティポリシーを恒久的に変更することなく、仮想環境を簡単に有効化できます。これにより、毎回のコマンド入力の手間を省くことができます。


参考:

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?