1
0

venv(仮想環境)コマンド自分まとめ

Last updated at Posted at 2024-03-03

pythonのプロジェクトごとに環境を管理するvenvのコマンドをまとめた。

コマンド

venv(仮想環境)ディレクトリの作成.

[ターミナル]
python3 -m venv [name]

仮想環境に入る.

[ターミナル]
source [name]/bin/activate

仮想環境から出る(仮想環境の無効化)

[ターミナル]
deactivate

venv(仮想環境)内にインストールされているライブラリ一覧をテキストファイルに出力する.

[ターミナル(仮想環境内)]
pip freeze > [name(requirements.txt)]

出力したテキストファイルを元にライブラリを一括インストールする.

[ターミナル(仮想環境内)]
pip install -r [name(requiirements.txt)]
1
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
1
0