はじめに
pyenv
を再インストールしたので、ついでにpyenv-virtualenv
(link)もインストールしてみる。
環境
macOS: Catalina 10.15.7
xCode: version 12.4
インストール
Homebrewでインストール。
terminal
$brew install pyenv-virtualenv
以下を.bashrc
に書き込む。
.bashrc
eval "$(pyenv virtualenv-init -)"
使い方
仮想環境の作り方
terminal
# Determine python version and create virtualenv
$ pyenv virtualenv 2.7.10 my-virtual-env-2.7.10
# Create vertualenv from current version
$ pyenv virtualenv venv34
仮想環境の確認方法
terminal
$ pyenv virtualenvs
仮想環境のActivateとDeactivate
terminal
$ pyenv activate <name>
$ pyenv deactivate
仮想環境の消し方
terminal
$ pyenv uninstall <name>