目次
文書の過去の版を表示しています。
Python venv 仮想環境
仮想環境の作成
Linux
$ python -m venv py38
Windows
> python -m venv py38
| py38 | 仮想環境フォルダ | ||
|---|---|---|---|
| + | Include | ||
| + | Lib | ||
| | | + | site-packages | 仮想環境のパッケージ | 
| + | Scripts | ||
| | | + | activate.bat | 仮想環境を有効化 (cmd.exe) | 
| | | + | Activate.ps1 | 仮想環境を有効化 (PowerShell) | 
| | | + | deactivate.bat | 仮想環境を無効化 | 
| | | + | pip.exe | pip コマンド | 
| | | + | python.exe | python コマンド | 
| | | + | pythonw.exe | pythonw コマンド | 
仮想環境の利用
Linux
$ source py38/bin/activate (py38) $
または
$ . py38/bin/activate (py38) $
Windows
> py38\Scripts\activate (py38) >
仮想環境の pip を更新
Linux
(py38) $ python -m pip install --upgrade pip
Windows
(py38) > python -m pip install --upgrade pip >
仮想環境の終了
Linux
(py38) $ deactivate $
Windows
(py38) > deactivate >
