目次
文書の過去の版を表示しています。
Python venv 仮想環境
仮想環境の作成
Linux
$ python -m venv py38
| py38 | 仮想環境フォルダ | |||
|---|---|---|---|---|
| + | include | |||
| + | lib | |||
| | | + | python3.8 | ||
| | | | | + | site-packages | 仮想環境のパッケージ | 
| + | bin | |||
| | | + | activate | 仮想環境を有効化 (bash) | |
| | | + | activate.csh | 仮想環境を有効化 (C shell) | |
| | | + | activate.fish | 仮想環境を有効化 (fish shell) | |
| | | + | pip | pip コマンド | |
| | | + | pip3 | ||
| | | + | pip3.8 | ||
| | | + | python | python コマンド | |
| | | + | python3 | ||
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 >
