Python|パッケージの仮想化
from Python
依存ライブラリの管理
1.icon仮想環境の作成
code:sh
python3 -m venv myenv
2.icon仮想環境の有効化
code:sh
source myenv/bin/activate
3.icon必要なパッケージをインストール
code:sh
pip install package_name
4.icon依存関係の記録
code:sh
pip freeze > requirements.txt
現在のPython環境でインストールされているすべてのパッケージとそのバージョン番号をリストとして表示するコマンド
このリストはrequirements.txtファイルに保存することで、別の環境でも同じパッケージとバージョンをインストールできるようにするために使用される
別マシンでの再現
1.iconプロジェクトをクローン
code:sh
git clone https://your_repository_url.git
cd your_repository
2.icon仮想環境の作成
code:sh
python3 -m venv myenv
3.icon仮想環境の有効化
code:sh
source myenv/bin/activate
4.icon依存関係のインストール
code:sh
pip install -r requirements.txt