pythonのプロジェクトごとに環境を管理するvenvのコマンドをまとめた。
コマンド
venv(仮想環境)ディレクトリの作成.
[ターミナル]
python3 -m venv [name]
仮想環境に入る.
[ターミナル]
source [name]/bin/activate
仮想環境から出る(仮想環境の無効化)
[ターミナル]
deactivate
venv(仮想環境)内にインストールされているライブラリ一覧をテキストファイルに出力する.
[ターミナル(仮想環境内)]
pip freeze > [name(requirements.txt)]
出力したテキストファイルを元にライブラリを一括インストールする.
[ターミナル(仮想環境内)]
pip install -r [name(requiirements.txt)]